Question

I have a Windows Form that takes quite a bit of time to load initially. However, each subsequent request to load the Form doesn't take as long. Is there a way to optimize a Form's load time?

Was it helpful?

Solution

You can use ngen.

I also use this tip to reduce the Memory footprint on startup.

The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead using the just-in-time (JIT) compiler to compile the original assembly.

OTHER TIPS

You need to find out where the time is going before you can optimise it. Don't just ngen it without finding that out first, as if the problem is loading a 150MB background bitmap resource then you won't have done anything useful at all with ngen.

You should disregard all specific advice or hunches about optimisation which arise without any measurements being made.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top