Jump to content
  • Advertisement
Sign in to follow this  
Calin

Unity [.net] C# speed tips

This topic is 4114 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know resources that talk about the execution time for various C# code snippets? I'm trying to build the engine of my game speed wise. I'm looking for things like those found here but on a wider range of topics. Calin

Share this post


Link to post
Share on other sites
Advertisement
This is not exactly what you were looking for but...
I use Microsofts fxCop to check my code for performance issues and other "bad things" and most of my performance errors it gives me has to do with creating strings when I don't need to. Not sure if this program will help, but it also checks for lots of other things too..

Share this post


Link to post
Share on other sites
That kind of information is very distributed, and very context-sensitive anyway. Trying to be this concerned about narrowly-focused performance up front is likely only going to lead you astray. What would be more beneficial is for you to actually get your code working, then isolate the bottlenecks with NProf or some other profiling tool, and use that to guide your research, as it will give you a specific area to focus on.

Share this post


Link to post
Share on other sites
Rico Mariani has a blog that discusses performance. Some of his posts are quite high level, while others focus on areas of .NET such as exceptions and memory leaks due to event handlers.

Share this post


Link to post
Share on other sites
Wow. Thanks everyone, it will take some time to chew everything.

P.S. For those interested in the subject there's also this page on MSDN

Calin



Share this post


Link to post
Share on other sites
C# performance is quite good and you shouldn't have any issues with plain logic code. The only thing worth optimizing (apart from using brute-force algorithms in stupid places, of course) is to keep the GC happy when you're designing larger projects.

There's lots of useful information in Shawn Hardgreaves' blog:
Twin paths to garbage collector nirvana
Delegates, events, and garbage

Once you digested that information, just focus on writing elegant and understandable code, any performance bottlenecks can be found with Microsoft's free CLR profiler:
Check out CLR Profiler 2.0

-Markus-

[Edited by - Cygon on July 18, 2007 12:51:31 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!