Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is WPF the reason my application is slow?

I am developing an application using WPF. The app runs full screen, and I need it to resize nicely no matter the monitor resolution. The graphic designer has designed beautiful images for the UI buttons, backgrounds, etc. Using an Illustrator plug-in, all the images have been converted to xaml files. I've added all these images into the application, and they look great. I am also using a lot of Grid layouts so that the screen can resize while still maintain the layout. All of this is displaying as desired, nothing looks stretched when run at a different resolution. However, screen transitions and UI interaction are slow.

I am wondering, is this is due to the heavy use of graphics? Am I using too many Grid layouts? But, I need the Grids so that I can have resolution independence.

The application runs fine on my development machine, but is very noticeably slower on machine with lower performance capabilities. Yeah, this is to be expected, but not to the degree that I'm seeing. My employer insists the application runs smoothly on these lower performance machines.

I've done some profiling of the application and it seem that what takes the most time is the display stuff (though I'm not sure I fully understand how effectively to use a profiler).

If it is the WPF that is causing the slowdown, what can I do to improve this?

like image 661
Dan Vogel Avatar asked Dec 12 '09 00:12

Dan Vogel


2 Answers

In general, WPF is perfoming much worse in drawing performance than Windows Forms, and native GDI or DirectX.

Yes, WPF is powerful in the sense you might make some neat stuff that is not supported in GDI, but it is more sluggish.

If you are having much drawing to do, and you want to support it on slow hardware, then WPF is not a good choice.

like image 171
oystein Avatar answered Oct 18 '22 18:10

oystein


You can drill into which WPF activities are using up time using the Performance Profiling Tools for WPF. Assuming a heavy graphical load is causing the slowdown, this should give you some help as to what might need to be simplified (e.g. layouts) or removed (e.g. bitmap effects (these are a classic perf killer, though I don't want to prejudice your profiling!)).

like image 44
itowlson Avatar answered Oct 18 '22 19:10

itowlson