C# timings skewed by JIT and assembly load

I have one complaint about the way timings are entered for C#. The timing of the test case has a base case of 100-300ms, due to CLR module initialization (JIT and assembly load). When writing algorithms that run in microseconds, this makes the measurement useless because host operating system concerns introduce variability greater than that introduced by optimizations to the system under test.

I would ask the following:
Either A) use a Stopwatch to measure the timing of the system under test in isolation, or B) repeat the test case until a statistically significant timeout (e.g. 1s) is reached, reporting an average timing.

Comments (0)