How to speed up WPF programs?

I also like programming for the Windows Presentation Framework. I mainly write browser-based applications using WPF and XAML.

But I'm really annoyed by the slowness of WPF. A simple page with several control elements loads quickly enough, but as soon as the page is more complex, but it will be more difficult, for example, it contains many data entry fields, one or two tab controls and so on, it becomes painful.

Loading such a page may take more than one second. Seconds, indeed, especially on not-so-fast computers (read: client computers), this can take years.

Same thing with changing values ​​on the page. Everything about the WPF interface is somehow messy.

It's so boring! They give me this beautiful structure, but make it so painfully slow, so I will have to apologize to our customers all the time!

My question is:

  • How to speed up WPF?
  • How do you identify bottlenecks?
  • How do you deal with slowness?

Since this seems to be a universal problem with WPF, I am looking for general tips useful for many situations and problems.

Some other related questions:

  • What tools do you use to develop WPF
  • WPF or Silverlight Application Development Tools
+48
performance wpf
Oct 21 '08 at 14:24
source share
9 answers
  • How to speed up WPF?

    Often after using one of the following profiling tools, it is obvious what causes my bottlenecks.

    • If there is a memory problem, I virtualize my data.
    • If rendering time is a problem, I virtualize the controls or simplify the control patterns where possible.
    • If processing time is a problem, I try to improve my algorithm or move this work to the background thread and show throbber in my ui while working.

  • How do you identify bottlenecks?

  • How do you deal with slowness?

    Profiling and consulting.

+36
Oct 23 '08 at 15:27
source share

Install Service Pack 1 (SP1). For WPF, very cool performance indicators are loaded.

More here

Here is an example of 2 enhancements made in SP1: Scrambled and recycled user interface elements !!!

+6
Oct 21 '08 at 14:29
source share

I cannot add comments, so I am posting a new answer to this question: I found this video with pdc09, which gives some ideas on how to profile wpf applications, and because it helped me, I want to share the link:

Advanced tuning and performance analysis of WPF applications

+5
Jun 01 '10 at 20:30
source share

Are you trying to use WPF PerfTool instead of what in VS?

+4
Oct 21 '08 at 19:01
source share

WPF is designed for computers with modern graphics cards. Do your customers have modern graphics cards that can control Aero? If your customers have older graphics cards, WPF will return to software rendering, which is very slow compared to hardware accelerated graphics.

You may also need to profile your application to make sure that it is actually WPF, which is the slow part. It is possible that there is something else that is actually a bottleneck.

+2
Oct 21 '08 at 15:21
source share

Avoiding animation also helps a lot sometimes. if you need to use animation, reduce the frame rate, this will improve the performance of "Feeled".

+1
Oct 21 '08 at 14:36
source share

Remove alpha transparency / bitmap effects.

+1
Feb 16 '09 at 16:25
source share

can you give more details?

I only noticed slow performance when I use something like a list or grid, which has some complexity. The solution is to simplify it.

Other than that, I noticed only slow performance when I first loaded the application.

NTN

0
Oct 21 '08 at 17:58
source share

I find it useful to use the XAML step and write the whole interface in C #. This allows me to precisely control when controls are created and loaded. It also helps me understand what XAML does under the covers.

0
Jun 23 '09 at 2:39
source share



All Articles