Unchecked C# keyword

Nov 9, 2010 at 3:39 PM
Edited Nov 9, 2010 at 3:40 PM

I just seen this today, never heard of the unchecked structure in C#. I did some initial tests and I did see a very* small performance increase inside loops. Balder might have many situations where this could be used to help increase performance. Such as texture mapping or other calculations where the likelihood of overflow is low. More testing needs to be done, and with silverlight too. 

Just wanted to pass this along, every little bit helps!



*very very very   (but in situations where there are loops in loops it might be worth it)

Nov 10, 2010 at 8:08 AM

This is very interesting for the inner parts of the engine - the drawing of pixels. 

Thanks for the tip - I vaguely recall the keyword, but thats just about it. 

Nov 10, 2010 at 7:43 PM

I should have done a bit more research before I posted. C# has all overflow checking off by default.  So, using an unchecked block probably won't have any effect.  Any performance increase I seen was probably due to invalid testing procedures :(   Ahh well.


Nov 11, 2010 at 6:32 AM

Too bad - was getting my hopes up for a good performance improvement with little effort.. :) 

Ahh.. Well..  Have to do it the hard way then. I guess.. :)