Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Improving WPF application speed over remote desktop?

In our scenario, we have a wpf application that is used by users over remote desktop, and we found the user experience is very slow.

Any suggestions for improving the user experience in this scenario? One point might be to disable any animation/storyboards, and avoid using gradients in the UI. More thoughts are appreciated.

like image 993
amazedsaint Avatar asked Dec 22 '22 10:12

amazedsaint


1 Answers

For gradients it's not as much of an issue as multiple rendering layers, such as if you have a bunch of nested controls all partially opaque. Take a look through the WPF Performance Optimization guides available. There's a lot of information in there to digest, but with the tips on rendering in there and the performance tools you should definitely be able to make some improvements.

UPDATE:
Jamie Rodriguez will post some of the internal discussions on WPF at Microsoft. There was a new post today, that includes tips and discussions on performance when remoting.

All versions of WPF since WPF 3.5 SP1 have remoted (both with Remote Desktop and Terminal Server) using Bitmap Remoting.

Bitmap remoting works as follows:

  • The application is rendered on the server using WPF’s software rasterizer
  • As the application runs, the server keeps track of which regions of the application’s window are newly dirty and need to be updated
  • When a region needs to be updated, the server creates a compressed bitmap of just the dirty region and sends that to the client
  • Once the client has drawn that bitmap to the appropriate place on its own window, the client window is up-to-date

Given how this remoting mechanism works, performance can be maximized in several ways:

  • Dirty regions should be kept as small as possible so the least amount of data is sent over the wire
  • Ambient animations should be turned off
    • For instance, setting a window background to an animating gradient would cause the entire window to be invalidated / redrawn every frame
  • The system does not optimize away occluded parts of the application
    • For instance, an animation that is completely hidden behind some other opaque element will still cause dirty region invalidation / bitmap generation to occur. Remove these from your application.
  • Dirty regions should be created as infrequently as possible
    • Turn off as many animations as possible
    • For those animations that can’t be eliminated completely, lower the animation framerate using the DesiredFramerate property
  • Dirty Region Bitmaps should be as simple as possible to maximize their compression
    • Application running over TS should favor solid colors over gradients or other exotic fills (unnecessary images, etc), especially for application pieces that will be redrawn frequently
  • Avoid operations that are especially slow when rendered in software
    • BitmapEffects / Effects / ShaderEffects, especially blurs and drop shadows with large radii, are quite slow in software
    • 3D – the 3D software rasterizer is substantially slower than rendering in hardware
like image 138
rmoore Avatar answered Jan 28 '23 22:01

rmoore