I deployed the application in release mode (x64), which I expected would be fast, and I noticed that there is a serious slowdown whenever a new method or set of methods is executed for the first time. When I say βharshβ, I mean 100-200 ms to execute for the first time, and after that it takes less than 1 ms.
From what I found, it seems to be related to the JIT compiler, which should compile the methods on first run. I expected some delay from this, but 100ms is a catastrophic delay in the middle of execution.
I know about NGen, but NGen needs to be done during installation on a machine. Machines for all have limited user rights and cannot install anything. The application is deployed as an executable and reference DLL. I think thatβs why I was never able to get NGen to work.
Is there a way to get JIT to compile each method at startup?
Although I create dummy variables, I add a start-up procedure that would do nothing but run each method once, so it might be that when you start the run. It would be enough to force compile or each method code path needs to be executed separately.
source share