While looking on Reggie's blog for news on MySQL support for the Entity Framework, I enjoyed reading this article. I continue to be amazed at the performance of the CLR. Some people are absolutely baffled that managed code could be faster than native code, and the low-level reasons why have been blogged by people far smarter than I in the past. Since someone just asked, A couple of the better-known reasons:
1) The managed heap rules: If I say "object* foo = new object();" in C++, the OS looks around to find some memory it can give me. CLR programs use a managed heap, however. Despite the fact that calling "new()" is always expensive, the managed heap gives a huge advantage. Instead of searching for free memory, the next chunk on the managed heap is returned immediately. C developers writing games have used similar tricks for years, using malloc to get a big chunk of memory and managing bits of it themselves as needed.
2) JIT rules: C# is always JITified before execution. JIT compiling turns your C# into machine code. So what, you say, my C/C++ code is pre-compiled for the platform and doesn't pay the JIT penalty on application startup. The advantage of the JIT is that it can be compiled each time the program is ran, and potentially take advantage of different situations and things specific not just to a processor architecture, but on each individual machine. (I need to find a link to cite this appropriately)
Anyway, read the article on Reggie's site, and thank him for the work he's doing. Hey Reggie, when is that preview of Connector 5.3 come out?
Remember Me
a@href@title, strike
Powered by: newtelligence dasBlog 2.0.7226.0
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2008, Damon Payne
E-mail