Welcome to WindowsClient.net | My Blog | Sign in | Join

Rob Relyea - XAMLified

WPF, Silverlight and XAML

Syndication

Sponsors





  • advertise here
Hey, you snooped my app! uh…thanks!

In an interesting post about “thoughts on WPF 4 from a novice” which discusses the effort to build MetroTwit, there are a bunch of interesting comments.

My favorite is http://www.istartedsomething.com/20100711/thoughts-on-wpf-4-0-from-a-novice/#comment-128631 where Nelson digs in and gives some great perf tips to the MetroTwit team.

From just looking at MetroTwit in Snoop, it’s still much too heavy visually. You need to optimize your visual tree, and your framerate will go up as a result. For example, there’s no need to have a RichTextBox for *every* item in the List.

Use a DataTemplateSelector and only show the RichTextBox when the mouse is hovered over it. For everything else, use a TextBlock which still maintains the formatting.

There’s also a gratuitous use of Grids where StackPanels would use. Grids are heavier visually than StackPanels, and their Layout passes are much more complex.

Freeze resources, use BitmapCaching where applicable, etc.

WPF has many ways to do things, but generally only a few work really well. It’s inherent in the flexibility of the platform.

How can Microsoft, and other parts of the WPF/Silverlight ecosystem, make it easier to get this kind of feedback for your app?

Published Monday, July 12, 2010 10:38 AM by Rob_Relyea
Filed under: , ,

Comments

# re: Hey, you snooped my app! uh…thanks!@ Monday, July 12, 2010 2:45 PM

There is a tool from Yahoo called ySlow, which points out various issues in websites that cause the site to be slower. Such a thing that performs static or runtime analysis on WPF apps to provide hints on how to improve performance would be very valuable.

# re: Hey, you snooped my app! uh…thanks!@ Monday, July 12, 2010 3:14 PM

I think the point Long was making is that there should be only one recommended way of doing what you want to do.  WPF and SL should take care of those optimizations for you.

Why isn't the RichTextBox optimization built into the control (that one has come up before).  Why not create a declarative way of handling freezables?  Could WPF use heuristics to work out BitmapCaching - i.e. learn from the nature of the app?

by Joe

# Twitter Trackbacks for Hey, you snooped my app! uh???thanks! - Rob Relyea - XAMLified [windowsclient.net] on Topsy.com@ Monday, July 12, 2010 6:07 PM

Pingback from  Twitter Trackbacks for                 Hey, you snooped my app! uh???thanks! - Rob Relyea - XAMLified         [windowsclient.net]        on Topsy.com

# re: Hey, you snooped my app! uh…thanks!@ Tuesday, July 13, 2010 1:35 PM

Nelson

But how many of those optimizations *could* be automated by the platform?  What instrumentation would help spot them sooner?

by Joe

# re: Hey, you snooped my app! uh…thanks!@ Friday, July 16, 2010 3:07 AM

Give those MetroTwit guys all the help they need.  Besides Visual Studio 2010, MetroTwit is the only other "showcase" WPF app that I'm aware of on my systems.  And right now, it is a memory pig which doesn't make WPF look good.  And IIRC, early drops of VS 2010 had similar issues with WPF memory usage/performance.  So I don't think the blame here lies solely on the MetroTwit team.  

# re: Hey, you snooped my app! uh…thanks!@ Friday, July 16, 2010 6:49 AM

Keith-

While the development of VS2010 definitely helped find and focus our attention on many flaws, it was surprising how few WPF perf fixes resulted from the entire effort.

Blend, in its early days, also was a pig.

We need to continue improve tooling, analysis, best practices and the platform to ensure that new WPF apps are running in a showcase manner, without having to involve us looking at your app.

Jossef Goldberg (PM for WPF/Silverlight Perf) is on an email thread with Long to help address questions and issues...

Thanks, Rob

# re: Hey, you snooped my app! uh…thanks!@ Monday, July 19, 2010 7:22 AM

It would be nice if this kind of information was available at compile time via FxCop or something similar.

by Will

Leave a Comment

(required) 
(required) 
(optional)
(required)