.NET: Windows forms/controls performance
We have an application with very heavy UI. Recently our clients started complaining to application startup performance. (Previously our controls/forms were initialized while a some kind of the splash screen with a message 'starting' was shown).
I've made a research and found that t开发者_StackOverflowhe control's InitializeComponent() (which is generated by VS designer) method call can take up to ~0.4-0.5s for complex controls. And there are a lot of such controls, so I'm getting ~10-15 seconds of application startup time as the result. There are nothing that could be really heavy there, only controls initialization (for example, different toolstrips, toolstripbuttons, menustrips initialization, setup of different texts etc).
Is there a way to improve performance of controls initialization in this case? Maybe some kind of caching or smth like that (so our application will start up slowly only during the first load)?
P.S. We're using .NET 2.0
Thanks in advance.
You indicate that you've performed at least some rudimentary analysis of your app's start-up time, but have you thoroughly profiled your app using Visual Studio's profiler, ANTS or similar?
Thoroughly profiling of your app will give you the most accurate break-down of where your app spends its time. Anything less and you're just guessing.
You might also consider NGEN'ing portions of your app and re-profiling your app's start-up times to determine whether the NGENning of your code actually delivered a performance boost.
However, if you've built something that's very complex, you may simply be asking too much of your users' machines. This is why it's VITAL to measure performance of your code on tin that's as similar as possible to your end-users' hardware and environment.
Another thing to consider is that WinForms doesn't really take advantage of modern-day hardware accelerated graphics. You may find that porting to WPF gives you just the boost you need, but be sure to prototype and profile carefully before committing significant resources to this path.
HTH.
Load data asynchronous
Buy faster pc's
Use WPF (.net 3.5)
精彩评论