When unsafe is better

I rewrote Peter Warden's wave video effect in C#. My first attempt was a straigthforward cut at it and the result wasn't pretty. I managed to treat 45-48 frames out of a total of 292. I looked at the original C++ code and it treated 261-262 frames. So I used unsafe code and rewrote my code in C# but "in a C-style". The result was much better. 256-258 frames were treated with my newer version or within 1-3% of the C/C++ equivalent. In fact, unsafe code with pointers in C# reminds me a lot of the inline assembly feature of VC++, for example.

Then I searched Google and found an interesting collection of articles by Mr. Net Performance, Rico Mariani, which stated: "The managed code got a very good result for hardly any effort".




Bookmark it...
Digg!Reddit!Del.icio.us!Google!Facebook!Slashdot!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!
 
< Prev   Next >
Joomla Template by Joomlashack
Joomla Templates by JoomlaShack Joomla Templates by Compass Design