Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to speed up the initialization of a .NET client application (Windows Forms or WPF)?

Sometimes I create some quick personal projects using C# with Windows Forms or WPF. I have noticed that managed applications can take 2x or 3x times longer to start compared with native applications.

I have written a "Quick Notes" application, however it isn't very "quick". :-(

What are some techniques to speed up the initialization of Windows Forms/WPF applications?

like image 306
Click Ok Avatar asked Jan 08 '09 23:01

Click Ok


4 Answers

Check out NGen

Also, if you are loading lots of data on load, move it to another thread and show an indicator or something (while it's loading) so at least the form pops up quickly, even if it takes a little longer for the actual data to load.

like image 113
scottm Avatar answered Oct 20 '22 00:10

scottm


.NET 3.5 SP1 does tend to make start up a little quicker. Also see a series of blog posts on putting up a splash screen (in native C++) while starting the WPF application at the Logos Blog.

like image 23
denis phillips Avatar answered Oct 20 '22 01:10

denis phillips


.NET 3.5 SP1 also now includes the ability to create a fast SplashScreen without using C++

like image 2
Hades32 Avatar answered Oct 20 '22 00:10

Hades32


You might also want to consider moving processing off to worker threads. When your app starts load the root UI, but not the data - rather load the data async (and create pad windows etc. as each data item comes in).

like image 2
Jonathan C Dickinson Avatar answered Oct 20 '22 02:10

Jonathan C Dickinson