Freigeben über


Performance improvements in WPF in .Net 3.5 / 3.0 SP1

Below is a list of the performance improvements that you can expect to see in WPF in .Net 3.5 and .Net 3.0 SP1:

**1.    ** Animations Smoothing Improvements

  • WPF Animation in .Net 3.0 SP1 is much smother.
  • These improvements are more noticeable on Vista and especially in upcoming Vista SP1, which includes additional smoothing in the Desktop Windowing Manager (DWM).

**2.    ** Layered Windows Improvements

Layered Window performance was one of top customer complaints. They are now addressed with a QFE/Hotfix.

These hotfixes are not available for direct download. End users should call Microsoft PSS to obtain them.

Developers and OEMs can contact Microsoft PSS to discuss redistribution rights.

The hotfixes will be included in the next service pack of Microsoft OS’s

For Windows Vista:

§       See: https://support.microsoft.com/kb/938660

§       Hotfix is forthcoming in Vista SP1 (fixes are in milcore.dll)

•        The Hotfix improves the read-back of video memory to system memory and therefore the degree of noticeable improvements will depend on certain machine characteristics, such as the video bus speed, the video bus type (e.g. expect better performance on PCIe vs. AGP bus), etc

For Windows XP/Server 2003:

§       Layered Windows was rendered in software, which had performance issues. The hotfix addresses this. On XP layered windows will render using hardware acceleration (if the hardware supports it).  If so, you should be able to see significant performance improvement with this hotfix.

§       See https://support.microsoft.com/kb/937106/en-us. (fixes are in d3d9.dll)

§       Hotfix is slated in the upcoming Windows XP SP3

 

Other Layered Window improvements:

.Net 3.0 SP1 fixes a performance issue that is related to user switching.

A Layered window app running under another user profile caused higher CPU usage. This is now fixed for both XP & Vista.

**3.    ** Data binding Improvements.  

Improvements should be noticeable in applications that bind to an XML source.

This improvement mainly relates to how WPF reacts to changes in the XML source tree.

**4.    ** Coldstart time

We made small incremental improvements to cold and warm startup time.

**5.    ** Working set / Runtime Improvements

We made incremental improvements to working set and hit testing under certain scenarios.

**6.    ** New Software rendering API

As reported (see here), depending on the machine configuration and the application, software-based rendering is sometimes faster than hardware.

A new API is now available to allow developers to force software rendering in his/her application (per window) instead of using the GPU.

This should provide developers a much better alternative than setting the global ‘Disable HW Acceleration’ registry key (See: https://msdn2.microsoft.com/en-us/library/aa970912.aspx)

Here is an example on how one can use this API.

        private void OnLoaded(object sender, EventArgs e)

        {

            if (ForceSoftware)

            {

                HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;

                HwndTarget hwndTarget = hwndSource.CompositionTarget;

 

                // this is the new WPF API to force render mode.

                hwndTarget.RenderMode = RenderMode.SoftwareOnly;

              }

        }

This could improve rendering performance for certain scenarios and machines configuration, in most cases HW rendering should perform better. Please use carefully and verify with your app and machine configuration

**7.    ** Other notable Graphics perf improvements

  • 3D hit testing is up to 50% faster in common scenarios of invertible transform. If the user only has one of the two Materials set we don’t hit test half of the mesh.
  • Fixed RenderTargetBitmap memory leaks which could caused crash in rare scenarios.

**8.    ** Battery life improvement

  • In certain Animation scenarios when DecelerationRatio / AccelerationRatio are used, the animation clock may continue ticking. This may cause additional (small) CPU activity that may be the cause for the battery results you are seeing.

This is addressed in WPF 3.0 Sp1.

It is important to note that the app developer can work around this issue by:

·       Not using DecelerationRatio / AccelerationRatio  in the app, or

·       Explicitly stopping the animation clock.

  • We integrated the WPF 3.0 Power Consumption QFE/Hotfix and it is now in WPF 3.0 SP1. 

(see https://support.microsoft.com/default.aspx/kb/925255)

Comments

  • Anonymous
    October 10, 2007
    PingBack from http://www.artofbam.com/wordpress/?p=6938

  • Anonymous
    October 10, 2007
    WPF Performance is a WPF performance related blogs.Two entries worth mentioning: Improving WPF applications

  • Anonymous
    October 10, 2007
    After WPF performance sessions is over, one of WPF performance PMs, Josef Goldberg discovered in his

  • Anonymous
    October 10, 2007
    WPF Performance is a WPF performance related blogs.Two entries worth mentioning: Improving WPF applications

  • Anonymous
    January 24, 2008
    Néhány napja került fel a Microsoft support honlapjára egy fontos, a WPF alkalmazások teljesítményét

  • Anonymous
    May 15, 2008
    As you know the .NET Framework 3.5 Service Pack 1 Beta download is now available. There are many improvements

  • Anonymous
    May 16, 2008
    I know I am a little late on blogging about .NET 3.5 SP1, but here goes... This is a huge release...

  • Anonymous
    March 18, 2009
    Great post! Especially for Intel's Atom CPU and GMA 500 graphics (Panasonic toughbook CF-H1) software rendering is many times faster than hardware!

  • Anonymous
    July 23, 2010
    The comment has been removed