How to speed up the first execution of my .NET application?

Our C # client applications always take much longer to load their first launch. I have not gone so far as to check if this is the first launch of any .NET application that runs slower, or if the first launch of each .NET application is slower, but in any case this remains a problem. How can we eliminate this one-time start-up?

My initial thoughts are that some service may β€œwarm up” libraries. Should we do this for each of our applications, or just .NET applications? Will the user service work, how to make a difference? Perhaps, instead of a Windows service, an application running Windows can do the dirty work? Again, is this enough to be a .NET service, or will we need to run each of our programs to eliminate the penalty? We could pass a command line parameter that tells the program to exit immediately, but will that be enough or will we need .NET to load each assembly that we will use during normal application execution?


Re: Some answers, we deploy DLL files in unlock mode, and deceleration occurs only at the first start. We delay class initialization as much as possible.

+3
source share
4 answers

Other answers talk about JIT time, but in my experience, another very important factor is the time taken to load the .NET platform for the first time after loading.

( , , , , ). . , ( ) - , .

+4

JIT (Just In Time), .net-. IL . , , , .

NGEN.EXE ...

, , JIT , . ...

+10

this ( ), this ( CLR .NET Framework 3.5 SP1) this ( NGen).

- , . , . Etc .. ..

+3

, .NET- MSIL .

You can possibly create your assemblies after installation, this will compile them into code and possibly prevent a delay in starting. WiX ( http://wix.sourceforge.net ) has a custom action that does just that.

+1
source

Source: https://habr.com/ru/post/1711358/


All Articles