Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News .NET Core 2.1 Previews Tiered Compilation

.NET Core 2.1 Previews Tiered Compilation

This item in japanese

The JIT compiling process used by .NET has always had to balance two competing objectives – faster application startup time versus faster application steady-state performance.  From the end-user perspective, perception of an application's startup speed can be negatively impacted if the JIT pauses at launch to calculate the best steady-state performance.  On the other hand, if the JIT favors faster application start time, then the application's steady-state performance will be sub-optimal.

In an effort to resolve this conflict, Microsoft's Noah Falk has announced the availability of tiered compilation for .NET Core 2.1.  This lets the JIT do multiple compilations and produce code that can then be hotswapped at runtime for the best overall performance impact.  The end result is an application starts fast and still has great steady-state performance.  

Since this feature is still in a preview state, it is not activated by default, but there a couple of ways to activate it for any .NET Core 2.1 application.  For applications that you are able to compile, simply add the MSBuild property <TieredCompilation>true</TieredCompilation>  to your project's default property group.

If you are running a previously compiled application for which you do not have the source, you can set a new property in runtimeconfig.json file in the configProperties section:  System.Runtime.TieredCompilation=true

Finally the environmental variable  COMPlus_TieredCompilation=1 can be used to enable tiered compilation without modifying any files.

It should be noted that at present this remains a feature specific to .NET Core, and is not slated for deployment on the .NET Framework.  Developers interested in experimenting with this new technology can also compare results viewing the JitBench project Microsoft has setup on GitHub.

Rate this Article