Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I avoid JIT in .NET?

Tags:

.net

jit

Say if my code is always going to be run on a particular processor and if I have this information during installation - is there a chance I can avoid JIT?

like image 422
Sesh Avatar asked Jan 15 '09 10:01

Sesh


People also ask

Does .NET use JIT?

Just-In-Time compiler(JIT) is a part of Common Language Runtime (CLR) in . NET which is responsible for managing the execution of . NET programs regardless of any . NET programming language.

Why does .NET use pre JIT?

"Pre-jitting" or pre-compiling will improve performance, at start up, because you would be skipping that step. The reason that . NET JITs every time an app and its libraries load is so that it can run on many platforms and architectures with the best possible optimizations without the need for managing your builds.

How does .NET JIT work?

The JIT compiler translates the MSIL code of an assembly to native code and uses the CPU architecture of the target machine to execute a . NET application. It also stores the resulting native code so that it is accessible for subsequent calls.

Does C# have JIT?

C# uses a combination of static compilation and JIT compilation. This entails that the code is compiled down to bytecode at the last possible moment. Static compilation compiles all the source code ahead of time.


1 Answers

Use NGEN:

The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead using the just-in-time (JIT) compiler to compile the original assembly...

For additional information on using Ngen.exe and the native image service, see Native Image Service...

like image 75
Igal Serban Avatar answered Oct 13 '22 11:10

Igal Serban