C# Tips

One of the things I noticed in my performance logs was that returning values from an array was a little slow.

http://msdn2.microsoft.com/en-us/magazine/cc301755.aspx talks about C# and arrays and mentions that by default C# does bounds checking on arrays. Well, my functions are already doing bounds checking. So to turn off C#’s bounds checking you simply put the code in an “unsafe” block.

The result is a couple more FPS.

My next test is to see which is faster: a single dimension array using a multiply or a two dimensional array.

Leave a comment

You must be logged in to post a comment.

ss_blog_claim=70b9168863fc97c91e6d88b40542a327 ss_blog_claim=70b9168863fc97c91e6d88b40542a327