I have just been reading some of the blogs based on Asp.Net and found that many developers have the issue of page load time in Asp.net application. Kentico is a popular web content management platform that allows developers to create cutting edge websites and optimize the digital experience of customers across multiple channels. Since Kentico is based on Asp.Net, it takes time during runtime compilation. Kentico developers who have been creating moderate size applications or even large ones are aware of it. Once the application is developed and compiled using Msbuild in Visual Studio and the first page is requested, the waiting begins and you have to wait for each page’s first load.
This is a disadvantage of Asp.Net and various efforts have been made to reduce this load time. Developers don’t like the time that pre-compilation requires after they make any changes in the code and at times they even want to avoid it. In this blog, I will discuss how to decrease the load time of any Kentico application using the latest complier of Asp.Net.
The .NET team has announced the availability of a new .Net complier platform “Roslyn” that represents the future of developing languages and compilation for .Net applications. This new platform offers open source C# and Visual Basic compliers with rich code analysis APIs. Compilation in Asp.Net applications usually takes place in two types: Project and Runtime compilation.
Project compilation is used by Asp.Net applications using the project system approach that is they have .csproj/.vbproj file. It takes place via the project system and Msbuild in Visual Studio. It compiles the C# or VB files and produces and assembles in the project’s \bin folder. Runtime compilation compiles many of the application’s assets on the web server when the app is running.
How Roslyn can Help to Decrease Page Load Time?
Using the Roslyn compiler in Asp.Net has many benefits like it supports new language features and offers potentially improved application startup/ pre-compilation time. The second feature is especially helpful for the customers with very complex or large apps. While testing a complex application, it has been observed that the runtime compilation cost dropped from 15 minutes to 70 seconds after enabling the CodeDOM Providers.
When using the aspnet_complier.exe, the new providers work equally well at runtime. The tool reads your app’s web.config file and loads the configured CodeDOM so that you gain the benefits. The new provider only replaces the compilation steps of Asp.Net’s runtime feature and the .cshtml, .aspx files are still parsed and the VB/C# code is still generated as before. But now the final compilation takes place using Roslyn.
Thus to conclude, I can say that Roslyn can be used to reduce the first request load time of any Kentico application by almost 50%.
Get in Touch
To discuss your next project or a no obligation consultation, contact us now