开发者

A 110 kb .NET 4.0 app needs 10 seconds for a cold start, thats not acceptable !

开发者 https://www.devze.com 2022-12-31 03:10 出处:网络
I am using the .NET 4.0 client profile for my app and I run a dual core with 4 GB Ram and a fast hard disk.

I am using the .NET 4.0 client profile for my app and I run a dual core with 4 GB Ram and a fast hard disk.

nothing big is done at the start just showing a generic List in a wpf listview.

How can I make the cold start faster of my assembly ?

I have done now again a cold start and run the windowsapplication.exe in my \obj\x86\Debug folder and my harddisk run like hell and it took 10,5 seconds ???

What is wrong?

The warm start after the cold one took 1 second.

Java 6 apps has not that problem, not at all just to compare...

UPDATE:

I remove all methods which read data when my ViewModels are created.

Still 10 seconds to show up. Its not a problem of reading data from RAM. The problem is the heavily busy harddisk which has never been that loud except running a .net 4.0 wpf app...

I do not reference any 3rd party dll`s.

These are the assemblies I reference:

Microsoft.CSharp Presentation.Core PresentationFramework System System.Core System.Data System.Xaml System.Xml System.Xml.Ling WindowsBase

UPDATE 2:

I created now a .NET 4.0 wpf project from scratch with just a empty window and green background;-)

The cold start took 3 seconds (Hard disk go开发者_运维知识库t very busy)

then I run my other wpf app which took earlier 10 seconds. Now it needs only 1,5 seconds to show up on screen.

The situation is now clear to me:

My application as nothing what could make it slow. Its just about the FIRST wpf app loaded or not.

I think I will do it like ADOBE Reader. Put a application accelerator... in the autostart being a small hello world wpf app...


You can use ngen to pre-compile your assemblies. That should help.

Edit: There may be one thing that can help. If this is a wpf application based on the "new wpf application" template in visual studio, your application will reference a bunch of assemblies that you may not use. Try to remove all unused assemblies from your applications references and see if that helps.


You might want to take a look at this MSDN blog post by Jossef Goldberg.


Thats not normal, do you make connections to a database or to some network? Waiting for some OS resource?


.Net apps start slowly compared to natively compiled apps, but that sounds excessive. Procmon may offer some insight into what it is waiting for.

0

精彩评论

暂无评论...
验证码 换一张
取 消