As far I recall the function is JIT'd when it is called second time.
What about the Main method? Would the code inside be JIT'd?
If I mesure some chunk of code, should I wrapped it in a function?
All .NET (MSIL) code has to be JIT'ed (compiled to native code) before it can be executed.
You are perhaps referring to the fact that once code has been JIT'ed it is cached. The overhead of JIT'ing is only incurred once. If you want to perform a benchmark without the JIT overhead you will have to "preheat" your benchmark or perhaps use NGEN to compile the MSIL permanently.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With