-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Description
A few years ago, tiered compilation was introduced on .NET. However, at least to my knowledge, it was never supported for dynamic methods. Having tiered compilation for dynamic methods would provide the same benefits it does for "pre-compiled" applications, faster startup when you have a lot of code that only needs to run once (and so the JIT optimizations might not pay off if it spends more time compiling the code than actually running it).
In the past I made emulators that translate machine code to .NET IL. One of the problems was that the JIT was quite slow, and at the time tiered compilation was not implemented. Some guest applications could take up to a few minutes to start due to the JIT cost, among other issues. Tiered compilation could improve that, and generally improve applications that needs to generate large amounts of dynamic methods.
It might be worth exposing some API to allow passing some hint to the JIT about the preferred compilation strategy for the dynamic method (like tiered, optimizations disabled or all optimizations). Personally I would be fine just getting tiered compilation for all dynamic methods, but maybe in some cases that's not desirable, so having the choice would be better.