Home > Uncategorized > WPF Performance

WPF Performance

I’m doing some work on performance in WPF. One curious standout is dashed lines. A pen with the DashStyle set to DashStyles.Solid is very much faster than one with DashStyles.Dash. Obviously this will only make a difference if you’re drawing a lot of them, but if you have a hundred or so on a Canvas, you will notice a severe degredation in the smoothness of scrolling the Canvas.

Advertisements
Categories: Uncategorized Tags:
  1. Mikhail Poda
    February 4, 2010 at 7:07 pm

    Please, let us know about your findings! I also run into this problem and it is a big pain. This is a reason I am going to switch to DirectX for charting inside WPF

  2. February 4, 2010 at 8:47 pm

    Quite exceptable : Think about vector tesselation .. A plain line is probably tesselated in a little numbe of triangles. When displaying a dot line, each line dot is probably coumpounded with many triangles.

    I guess there is an relatively easy trick to solve partially the problem : Just try to set the stroke brush with an image patten,alternating plain color and transparent zone, simulate the dots. But all line segments should be separated, to modify the brush transform matrix so that it match the line orientation.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: