Silverlight Performance Optimization

Source: Internet
Author: User

Author: NASAArticleSource: my appointment with the future (http://nasa.cnblogs.com /)

Performance Optimization

Performance monitoring (FPS )【FPS(Frames per second): number of frames transmitted per second .]

The presentation Performance of Silverlight varies depending on the complexity of the specified host parameters and content. To monitor the FPS value, we set the enableframeratecounter attributeTrue. In this way, the browser status bar displays the number of frames per second (FPS) of the displayed Silverlight content, so that you can fine-tune the applicationProgram. There are two ways to set enableframeratecounter:

 

 1. Set enableframeratecounter = true in the attributes of the object tag.

 

<Div id = " Downpanel  " >
<Asp: Silverlight id = " Xaml1 " Runat = " Server " Enableframeratecounter = " True " Source = " Clientbin/logsilverlight. xap " Minimumversion =" 2.0.31005.0 " Width = " 100% " Height = " 100% " Enablegpuacceleration = " True " >
<Pluginnotinstalledtemplate>
_ </Pluginnotinstalledtemplate>
</ASP: Silverlight>
</Div>

2. In CSCodeSet in (I personally think it is not easy to control)

 

 
System. Windows. InterOP. silverlighthost host = application. Current. Host;
System. Windows. InterOP. settings = host. settings;
Settings. enableframeratecounter =True;
Settings. maxframerate =60;

Notes for performance optimization:

1. Use transparent background with caution

The use of the transparent background of the Silverlight plug-in has a great impact on the performance. Therefore, avoid using this function whenever possible. Example:

 

 

param name =" background " value =" Transparent " /> param name =" windowless " value =" true " />

 

2. Try to use various acceleration and caching Methods

Set its cachemode attribute to true for an animation. Set the textrenderingmode attribute to renderforanimation. set its cachemode attribute to true for an opacity object and a rotation or stretch object.

3. Try to use visibility instead of opacity

 If you want to set an element to be invisible, try to use visibility, because the opacity of Silverlight rendering technology will continue to consume system resources. By setting the enableredrawregions attribute, you can see their differences more intuitively, for example:

 

< Param Name = "Enableredrawregions" Value = "True" />

 4. Do not pair mediaelementPathElement setting width and height

Setting these attributes will lead to additional stretching, which will affect performance.

5. Use stretch = "fill" when presenting a large number of images"

All types of stretching except fill and none require calculation layout (for example, calculation center ).

6. Use backgroundworker whenever possible during massive data processingWhen a large amount of data is processed, the plug-in stops rendering. S

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.