Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Precompile" C# .Net 2.0 Application Into Native Code?

Status
Not open for further replies.

Insider1984

Technical User
Feb 15, 2002
132
US
Hi. We have an application that we (for performance reasons) would like to compile into native code at build inside of 1st run.

What is the best way to do this? I also understand the downside to this but we are certain we need this for immediate speed as the JIT compiling is too slow for the first run of the application code.

I have done a few searches here and on google but I'm not exactly sure what to search for.

We are running Windows 64-bit .Net 2.0 VS 2005 SP1 if that information is needed.

Thanks!

=====================
Insider
4 year 'on the fly' programmer
C, C++, C#, MFC, Basic, Java ASP.NET
 
You can use the NGEN.EXE (comes with the framwork), but there are some caveats, in that there are certain situations where the app will revert to using the JIT'd code. Usually this is after the user runs Windows Update, but there are others too.

So if you want to run NGEN for your assemblies, I would suggest you ship a .cmd file that does it, so that your users can run it after seeing a slowdown.

Note that for the majority of applications, this is an unneeded step. If you've spent time in the .net profiler, optimizing out the costly parts of your code, you may not need to do this.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top