We have a C# program that performs some timing measurements. Unfortunately, the first time it measures is 20x slower than the second and subsequent times, probably due to JIT (Just-In-Time) compiling.
Is there a way to ensure, on startup, that every line of MSIL code in the entire application is compiled with the JIT compiler?
As ta.speot.is said, the answer is probably using NGEN; this is a tool the pre-jits your assembly and turns it into native code for the platform you’re running on.
Often its run during the setup phase of your application because of this.
MSDN have a guide here:
http://msdn.microsoft.com/en-us/library/6t9t5wcf(v=vs.71).aspx