Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the Main method JIT'd?

Tags:

c#

clr

jit

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?

like image 769
Lukasz Madon Avatar asked Aug 02 '26 20:08

Lukasz Madon


1 Answers

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.

like image 54
Martin Liversage Avatar answered Aug 04 '26 11:08

Martin Liversage



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!