简体   繁体   中英

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?

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.

.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.

.NET 3.5 SP1现在还具有无需使用C ++即可创建快速SplashScreen的功能

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).

为.NET 3.0或更高版本制作的.NET应用程序在Windows,Windows Vista,Windows 7等较新版本上的运行情况要好得多。我认为在几年后,托管和非托管代码之间的性能差异将不明显。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM