Mahdi Ghiasi
Mahdi Ghiasi

Reputation: 15301

WPF Application takes too long to start

I am creating a WPF Application that uses Fluent library.

On my computer with Windows 7, 2GB RAM and AMD Triple Core processor, after double clicking on the program icon, The Splash image shows after about 1-2 seconds.

But on my brother's old computer with Windows XP, 512MB RAM and Intel Celeron 2.0 GHz Processor (Single core), after double clicking on the program icon, First, a process called PresentationFontCache.exe runs and it uses almost 100% of CPU for some seconds. And Total time is needed for displaying the initial Splash image is almost 30 seconds (or more).

I don't want that some users have to wait 30 seconds for displaying splash image and about 7-8 seconds for loading application. (my application load process takes 7-8 seconds)

Also I think 1-2 seconds is too high for just display initial SplashImage, It should display immediately.

How to solve this problem?

Upvotes: 2

Views: 2147

Answers (3)

TehBoyan
TehBoyan

Reputation: 6890

Sound like you could profile your application for performance to see where your bottleneck is and discover what is causing it so that you can know what to fix in your code to optimize performance.

You can use the classes System.Diagnostics namespace. Like PerformanceCounter class etc.

If you have some money to spend you could use RedGate Develper Bundle for .NET It has Performance profiler, Memory profiler etc.

There also other cheaper alternatives.

Upvotes: 1

TomTom
TomTom

Reputation: 62093

But on my brother's old computer with Windows XP, 512MB RAM and Intel Celeron 2.0 GHz Processor

Yeah, and guess waht - starting internet exlporer also takes a long time. This is not a computer, it is crap. At least 1gb memoery would help. WPF apps are not super low resorue aapps, they are made for modern OS.

I don't want that some users have to wait 30 seconds for displaying splash image

Use the .NET standard flash mechanism (that loads even before the runtime is fully initialzied).

http://www.abhisheksur.com/2010/05/creating-splash-screen-without-code.html

THEN load the WPF code.

Upvotes: 4

Mohan Kumar
Mohan Kumar

Reputation: 6056

Presentationfontcache.exe is a is a Windows Presentation Foundation Service from Microsoft Corporation belonging to .NET Framework. It normally uses high CPU.

You could try stopping the service, by deleting the file it creates: Windows\ServiceProfiles\LocalService\AppData\Local\FontCache4.0.0.0.dat and restarting the service to check if that helps.

Upvotes: 0

Related Questions