About Me

Tuesday, April 8, 2014

Power and Performance of C++ Comes to C# with .NET Native

Sometimes it is very difficult choice to make whether to go for C++ with its power and performance or choose C# with the managed code and development speed. Microsoft recently gave a resolution to above question. Microsoft “.Net Native” is a compiler (currently supports for x64) which improves performance of .NET applications by precompiling managed code in to native codes using Microsoft’s C++ backend infrastructure. This mechanism is different from the NGen. 

NGen will compile .NET managed code into processor specific native images and stores it in local computer’s native image cache. Then the runtime can use native image cache instead of Just-In-Time(JIT) compiler to compile the original assembly.

However .NET native initially generates MSIL which will next processed by C++ optimizer, generating MDIL (Machine dependent intermediate language). These optimizations have increased the start up time up to 60%, while the memory footprint has been lowered by 15%, according to Mani Ramaswamy, Project Manager of the .NET Native team. .NET Native is currently a preview and is targeted at Windows Store apps, but the team intends to extend it to the general desktop .NET apps.

Getting started with .NET Native