Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET: Roslyn slow on page changes

i have an VB.NET ASP.NET (4.6.1) MVC Application which is build with the new Roslyn Compilers.

Everytime i change a (vbhtml) File and reload the page it takes approx 9 seconds to reload the page. In this time a vbc.exe and a VBCSCompiler.exe are running:

enter image description here

I couldn't find any hints for this slow performance (using ANTS Profile) and my System should be fast enough to handle the Requests much quicker (Windows 10 x64, i7-2600, 16GB RAM, Samsung SSD for all files).

i also tried the new Roslyn Builds, but nothing changed:

<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform"version="1.0.1" targetFramework="net452" />

Any Ideas, how i can get better reload times?

UPDATE1: When removing the package Microsoft.CodeDom.Providers.DotNetCompilerPlatform my page reload time goes down to <500ms!

like image 443
Christoph Avatar asked Feb 03 '16 18:02

Christoph


2 Answers

The new compiler takes several seconds to start since it needs to JIT many IL assemblies. Ngen'ing the compiler and its dependency assemblies would help reduce the starting time. What you can do is to find the compiler assembly and do

ngen.exe install VBCSCompiler.exe
ngen.exe install csc.exe
ngen.exe install vbc.exe

You would need to run the above commands from an elevated console. And you may need to use the 64-bit ngen.exe if your machine is 64-bit. Normally the 64-bit ngen.exe locates in C:\Windows\Microsoft.NET\Framework64\v4.0.30319.

like image 155
X-Mao Avatar answered Nov 06 '22 04:11

X-Mao


FYI, I've been working with Microsoft on a solution to this, and it as not as simple as NGENing the assemblies. There are two issues they are working on to address it, one of them is in the Roslyn compiler itself. You can track that bug here: https://github.com/dotnet/roslyn/issues/10413. If the other bug comes up on a public tracker, I will be sure to link to it.

like image 27
Robert McLaws Avatar answered Nov 06 '22 03:11

Robert McLaws