Reputation: 5547
Even the most basic application with a simple window takes several seconds to start while its Win32 equivalent loads in a split second.
I read that the delay is not due to the time it takes the JIT to turn the opcode into machine code, but rather the time it takes Windows to load the .Net framework.
So, using MS' tasklist.exe CLI application, I checked if mscoree.dll was already loaded:
C:\>tasklist /m mscoree.dll
Image Name PID Modules
========================= ====== =====================
explorer.exe 368 mscoree.dll
BSQLServer.exe 652 mscoree.dll
TOTALCMD.EXE 408 mscoree.dll
Uedit32.exe 260 mscoree.dll
OUTLOOK.EXE 1912 mscoree.dll
Next, I ran my basic application with just an OK button, but it still took several seconds to be displayed.
Assuming mscoree.dll is indeed the proof that .Net is loaded, at least to handle basic Windows, then why the delay? FWIW, it's on an XPSP3 host.
Even if the whole .Net framework is loaded for each process, since it's already up and running for other processes, I assume it'll just copy the code from those other processes in RAM?
Thank you.
Edit: It seems like slower initial startup time was due to using an antivirus/firewall application, not to the JIT or loading .Net. Another possible issue: If your app is a bit slow to start from a cold state, make sure it only loads the bare minimum at start time.
Upvotes: 5
Views: 4196
Reputation: 71
Avast Antivirus also uses a technique called "Deepscreen" which check excutable files before they are allowed launch. I added an exception for the path to my VB.NET application in Avast Exlusions setting screen and it now starts instantly without any abnormal delay.
Upvotes: 2
Reputation: 3531
I have a simple c# test app on windows 7 that starts up instantly, no delay. This is when I doubleclick the executable in explorer. From within VisualStudio it takes seconds because VS then checks if things needs to be compiled, probably does some instrumentation for debugging etc. etc.
Upvotes: 2