SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Pandurang Nayak              Sumeet Jindal
Client Platform Evangelist   Senior Developer
Microsoft Corporation        Vectorform
Why are we here?
 Learn the inner workings of Silverlight
 Understand rendering pipelines

 Find tips and techniques for building great SL
 applications
 Learn performance best practices
 Understand how to profile your apps

 Peek into few advanced features in the upcoming
 Silverlight 3
Information Sources
 Silverlight Performance Team
 Silverlight Product Team
 Top Silverlight Bloggers and Experts
 Internal MS Silverlight Communities
 My Own Experience with Customers
Silverlight Architecture

                                 User Code

                        Controls

                            Managed Interop

CoreC   Property                                              Deep
                   Layout      Text     Media        Gfx      Zoom
                                                                     Image
 LR      System


                                      Interaction between
                                      pipelines via brushes
Graphics Pipeline
 Cross-Platform
   Develop once, run anywhere
 Retained Mode Graphics System
                    dirty rectangle
The UI Thread
On The UI Thread                 On the Non-UI Thread

   User Code                          Frame Rasterization
   Control Code                       Media Decoding
   Animations
   Layout
                                                            Master
                                                             Tip

 Silverlight is hosted in the browser.
 So, the (single) UI Thread belongs to the browser!
The Animate Loop
                          Tick                     Event Handlers



     Ask browser
                                    Any Property
       to show
                                     Changes?
        frame
                               By


                    default,




     Rasterize in
                                      Layout
     back buffer


                     Queue up
                     Rendering
                      Changes
Animation Basics
      Frequency is the plugin’s framerate
      Real-Time Animation (vs. Frame-based)
      Types of animations:
           Interpolation Animations
               ColorAnimation, PointAnimation, DoubleAnimation
           Splines, KeyFrames
           ObjectAnimation


http://silverlight.net/quickstarts/
blend_quickstart/part3_animations.aspx
Knowing Animations
 We only redraw the dirty rectangle
 Avoid large scale animations
 Text redraw triggers the font hinting algorithm

                                                  Master
                                                   Tip

 When in doubt, use:
 agControl.settings.EnableRedrawRegions = true;
Using EnableRedrawRegions
The Update Loop
                      Tick                     Event Handlers



     Ask browser
                                Any Property
       to show
                                 Changes?
        frame




     Rasterize in
                                  Layout
     back buffer


                    Queue up
                    Rendering
                     Changes
Layout and Draw
                                                   ListBox

   Designed for Nesting
                                             ScrollViewer
   Two Passes:
       Measure & Arrange
                                                    Grid
   Extensible
                                      ScrollBars             StackPanel



                                  Master                   ListBoxItem
                                   Tip

Nested flow layout that changes
often is expensive.                                             Some Stuff
The Update Loop
                      Tick                     Event Handlers



     Ask browser
                                Any Property
       to show
                                 Changes?
        frame




     Rasterize in
                                  Layout
     back buffer


                    Queue up
                    Rendering
                     Changes
Rasterization
 All changes for a frame are drawn at once
 Identify what causes a framerate drop

                                                   Master
                                                    Tip

  Measure maximum framerate to tune your
  application:
  sender.settings.EnableFramerateCounter = true;
  sender.settings.MaxFrameRate = 1000;

  Integrate codepaths via Brushes
Brushes
 A brush maps a screen position to a color
 Brushes in Silverlight
     SolidColorBrush
     LinearGradientBrush
     RadialGradientBrush

     ImageBrush
     VideoBrush


                                                        Master
                                                         Tip

            When mixing pipelines, brushes are cheap!
Image and Video Brushes in Silverlight
Rasterization and Anti-Aliasing
 Vector Graphics   - Anti-aliased
 Animation         - Anti-aliased
Rasterization and Anti-Aliasing
 Blurry Image Rendering
    Cause: Interpolation
Rasterization and Anti-Aliasing
 Blurry Thin Lines
    Cause: non-int positions
Rasterization and Anti-Aliasing
 Seaming
     Cause: non-int positions
  c = .5(.5*cbkgrd + .5*ctop) + .5(.5*cbkgrd + .5*cbottom)
Rasterization and Anti-Aliasing
 In Silverlight 2 RTM,
      Vector Graphics      ‱ Already Correct Behavior



         Animation         ‱ Already Correct Behavior



     Image Rendering       ‱ Layout Rounding NEW!!!



        Sharp Lines        ‱ Layout Rounding NEW!!!


                           ‱ Overlap edges
          Seaming          ‱ Change Background Color

    Non-Integer positioning mainly arises from Text and “Center”
Media Rendering
 halo.wmv is 300x400. Which is least expensive?

 <MediaElement Source=“halo.wmv”

 a.   Width= quot;225quot; Height=quot;300quot;   />
 b.   Width=quot;300quot; Height=quot;400quot;    />
 c.   Width=quot;303quot; Height=quot;404quot;    />
 d.   Width=quot;450quot; Height=quot;600quot;    />
Media: Every Pixel, Every frame!
       Rinse & Repeat, at the video framerate




 Encode at the minimum framerate that you need.
 Encode at the desired size
 Blending with media is expensive
                                                        Master
                                                         Tip

     Let the media pipeline decide the best framerate
Media Rendering
 halo.wmv is 300x400. Which is least expensive?

 <MediaElement Source=“halo.wmv”

 a.   Width= quot;225quot; Height=quot;300quot;   />
 b.   Width=quot;300quot; Height=quot;400quot;    />
 c.   Width=quot;303quot; Height=quot;404quot;    />
 d.   Width=quot;450quot; Height=quot;600quot;    />
Media Rendering
 halo.wmv is 300x400. Which is least expensive?

 <MediaElement Source=“halo.wmv”

 a.   Width= quot;225quot; Height=quot;300quot;   />
 b.   Width=quot;300quot; Height=quot;400quot;    />
 c.   Width=quot;303quot; Height=quot;404quot;    />
 d.   Width=quot;450quot; Height=quot;600quot;    />
Shrinking video causes
(Ex: 300x400 to 225x300)

  Extra bandwidth for extra 75x100px
  Decoding extra 75x100px
  Interpolation of every pixel in the 225x300 grid
     Pretty awesome interpolation, but never as good as
     native rendering
Profiling Silverlight Applications
 Steps:
  1.   Observe
  2.   Hypothesize
  3.   Develop Testing Protocol
  4.   Experiment
  5.   Make Conclusion
Debugging Settings
Sys.Silverlight.createObjectEx({
     source: quot;xaml/Scene.xamlquot;,
     parentElement: document.getElementById(quot;SilverlightControlHostquot;),
     id: quot;SilverlightControlquot;,
     properties: {
          width: quot;500quot;, height: quot;500quot;,
            isWindowless: false,
             background: quot;FF000000quot;,
             framerate: quot;10000quot;      },
          events: { onLoad:onLoadHandler} });

function onLoadHandler() {
     agControl = document.getElementById(quot;SilverlightControlquot;);
     /* To see the framerate displayed in the browser status bar */
      agControl.settings.EnableFrameRateCounter = true;
     /* To see the redraw regions*/
      agControl.settings.EnableRedrawRegions= true;
}
Your Animation is stuttering
What is the first step to debug?
a. Decrease the framerate
b. Identify the resource constraint
c. Turn on Redraw Regions

                                                             Master
                                                              Tip

     While debugging render issues, always try to identify
     what is blocking the UI thread.
xperf
 ETW – Event Tracing for Windows
    Tracing mechanism for both user-mode & kernel-
    mode apps
    Silverlight & CLR have embedded ETW events
 Analyzes unmanaged callstack
 Describes CPU cycles over time
xperf
Step 1: Install Microsoft Windows Performance Toolkit
http://msdn.microsoft.com/en-us/performance/default.aspx

Step 2: Admin-level CMD prompt

Step 3: xperf –on base

Step 4: Run scenario try to make all parts fully visible.

Step 5: xperf –d myprofile.etl

Step 6: xperfview myprofile.etl (or open Performance Analyzer)
Step 7: set _NT_SYMBOL_PATH=
        srv*C:symbols*http://msdl.microsoft.com/downloads/symbols

Step 8: Trace > Load Symbols

Step 9: Select Graph, right-click and choose Summary

Step 10: Run again to make sure results were sampled correctly
xperf
What happens on Navigation


                          Download                                Create
         Navigate                             Download JS
                            HTML                                  Plug-in



   Load              Extract             Launch
                                                      Control.Source is XAP
Assemblies           Manifest              CLR



Create          Object
                                Set Visual
 App            Creates
                                  Root
Object           Tree
XAML Parsing Uncovered!
 URI-based resources are loaded when added to
 tree
    Asynch
    Cached via Browser
 Build unique tree for each Control
 Pull in Text Stack
Text Stack
 TextBlock & TextBox
 Glyph Capabilities
 Text Stack
    Cross-OS consistency
    Glyph rendering is optimized for reading
    Anti-aliasing, H/V dropout, Gamma Correction
  These paths can be hit each tick if one is not careful
 Accepted Fonts
    Cross-OS, common set already on OS
    EA fonts, only if installed on machine
Silverlight Spy
 View Visual Tree for Silverlight applications
 Along with .NET Reflector, can show you entire
 structure and code of Silverlight applications


                                                         Master
                                                          Tip

    Confidential stuff should always reside on server!
    ANYTHING on the client can be exposed.
Silverlight Spy
References
 Performance Bloggers
 http://blogs.msdn.com/seema
 http://blogs.microsoft.co.il/sasha
 http://blogs.msdn.com/tess/
 http://blogs.technet.com/markrussinovich/

 Silverlight Spy
 http://silverlightspy.com/
Session Resources
Windows Performance Toolkit:   http://msdn.microsoft.com/en-us/performance



Silverlight                    http://www.silverlight.net



More Advanced Sessions         http://2009.visitmix.com
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should
 not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,
                                                                           IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Weitere Àhnliche Inhalte

Was ist angesagt?

[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform
[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform
[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform
Vitor Tomaz
 
Tech Ed09 India Ver M New
Tech Ed09 India Ver M NewTech Ed09 India Ver M New
Tech Ed09 India Ver M New
rsnarayanan
 

Was ist angesagt? (14)

At Scale With Style
At Scale With StyleAt Scale With Style
At Scale With Style
 
Orange is v cops
Orange is v copsOrange is v cops
Orange is v cops
 
App Dynamics & SOASTA Testing & Monitoring Converge, March 2012
App Dynamics & SOASTA Testing & Monitoring Converge, March 2012App Dynamics & SOASTA Testing & Monitoring Converge, March 2012
App Dynamics & SOASTA Testing & Monitoring Converge, March 2012
 
PG Day Us: Animations for Web & Hybrid
PG Day Us: Animations for Web & HybridPG Day Us: Animations for Web & Hybrid
PG Day Us: Animations for Web & Hybrid
 
[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform
[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform
[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform
 
Acme Packet Provisioning Framework
Acme Packet Provisioning FrameworkAcme Packet Provisioning Framework
Acme Packet Provisioning Framework
 
Erjang - A journey into Erlang-land
Erjang - A journey into Erlang-landErjang - A journey into Erlang-land
Erjang - A journey into Erlang-land
 
[AzurePT] Desenvolvimento para o Windows Azure: Diferença para o developer
[AzurePT] Desenvolvimento para o Windows Azure: Diferença para o developer[AzurePT] Desenvolvimento para o Windows Azure: Diferença para o developer
[AzurePT] Desenvolvimento para o Windows Azure: Diferença para o developer
 
IBM System z - zEnterprise a future platform for enterprise systems
IBM System z - zEnterprise a future platform for enterprise systemsIBM System z - zEnterprise a future platform for enterprise systems
IBM System z - zEnterprise a future platform for enterprise systems
 
IBM Cloud Burst postavenĂĄ na platforme IBM System x
IBM Cloud Burst postavenĂĄ na platforme IBM System xIBM Cloud Burst postavenĂĄ na platforme IBM System x
IBM Cloud Burst postavenĂĄ na platforme IBM System x
 
Tech Ed09 India Ver M New
Tech Ed09 India Ver M NewTech Ed09 India Ver M New
Tech Ed09 India Ver M New
 
4
44
4
 
Flash Platform for Multi Screen Development
Flash Platform for Multi Screen DevelopmentFlash Platform for Multi Screen Development
Flash Platform for Multi Screen Development
 
Vision dt solutions vmug leeds
Vision dt solutions vmug leedsVision dt solutions vmug leeds
Vision dt solutions vmug leeds
 

Andere mochten auch

Andere mochten auch (9)

SSAS - Other Cube Browsers
SSAS - Other Cube BrowsersSSAS - Other Cube Browsers
SSAS - Other Cube Browsers
 
Innovation durch Scrum und Continuous Delivery
Innovation durch Scrum und Continuous DeliveryInnovation durch Scrum und Continuous Delivery
Innovation durch Scrum und Continuous Delivery
 
Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...
 
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs LifeTesting with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
 
Reports with SQL Server Reporting Services
Reports with SQL Server Reporting ServicesReports with SQL Server Reporting Services
Reports with SQL Server Reporting Services
 
Clean Code Development
Clean Code DevelopmentClean Code Development
Clean Code Development
 
Continuous Delivery with TFS msbuild msdeploy
Continuous Delivery with TFS msbuild msdeployContinuous Delivery with TFS msbuild msdeploy
Continuous Delivery with TFS msbuild msdeploy
 
OLAP – Creating Cubes with SQL Server Analysis Services
OLAP – Creating Cubes with SQL Server Analysis ServicesOLAP – Creating Cubes with SQL Server Analysis Services
OLAP – Creating Cubes with SQL Server Analysis Services
 
Don't make me wait! or Building High-Performance Web Applications
Don't make me wait! or Building High-Performance Web ApplicationsDon't make me wait! or Building High-Performance Web Applications
Don't make me wait! or Building High-Performance Web Applications
 

Ähnlich wie Advanced Silverlight

Understanding hardware acceleration on mobile browsers presentation
Understanding hardware acceleration on mobile browsers presentationUnderstanding hardware acceleration on mobile browsers presentation
Understanding hardware acceleration on mobile browsers presentation
Justin Dorfman
 
InduSoft VBScript Webinar
 InduSoft VBScript Webinar InduSoft VBScript Webinar
InduSoft VBScript Webinar
AVEVA
 
WPF for developers - optimizing your WPF application
WPF for developers - optimizing your WPF applicationWPF for developers - optimizing your WPF application
WPF for developers - optimizing your WPF application
Tamir Khason
 
Adobe AIR - Mobile Performance – Tips & Tricks
Adobe AIR - Mobile Performance – Tips & TricksAdobe AIR - Mobile Performance – Tips & Tricks
Adobe AIR - Mobile Performance – Tips & Tricks
Mihai Corlan
 
Css3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQueryCss3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQuery
Andrea Verlicchi
 
Silverlight 4 & Windows Phone 7 at Zup Zip Black Coffee#5
Silverlight 4 & Windows Phone 7 at Zup Zip Black Coffee#5Silverlight 4 & Windows Phone 7 at Zup Zip Black Coffee#5
Silverlight 4 & Windows Phone 7 at Zup Zip Black Coffee#5
SoftEngine
 
Jimwebber soa
Jimwebber soaJimwebber soa
Jimwebber soa
d0nn9n
 
Dependency injection
Dependency injectionDependency injection
Dependency injection
housecor
 
Microsoft silverlight
Microsoft silverlightMicrosoft silverlight
Microsoft silverlight
Nguyen Tran
 
Understanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile BrowsersUnderstanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile Browsers
Ariya Hidayat
 

Ähnlich wie Advanced Silverlight (20)

Understanding hardware acceleration on mobile browsers presentation
Understanding hardware acceleration on mobile browsers presentationUnderstanding hardware acceleration on mobile browsers presentation
Understanding hardware acceleration on mobile browsers presentation
 
Understanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile BrowsersUnderstanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile Browsers
 
Wpf Tech Overview2009
Wpf Tech Overview2009Wpf Tech Overview2009
Wpf Tech Overview2009
 
Mike Taulty MIX10 Silverlight 4 Accelerated Fundamentals
Mike Taulty MIX10 Silverlight 4 Accelerated FundamentalsMike Taulty MIX10 Silverlight 4 Accelerated Fundamentals
Mike Taulty MIX10 Silverlight 4 Accelerated Fundamentals
 
InduSoft VBScript Webinar
 InduSoft VBScript Webinar InduSoft VBScript Webinar
InduSoft VBScript Webinar
 
JSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph PicklJSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph Pickl
 
WPF for developers - optimizing your WPF application
WPF for developers - optimizing your WPF applicationWPF for developers - optimizing your WPF application
WPF for developers - optimizing your WPF application
 
Build 2017 - B8100 - What's new and coming for Windows UI: XAML and composition
Build 2017 - B8100 - What's new and coming for Windows UI: XAML and compositionBuild 2017 - B8100 - What's new and coming for Windows UI: XAML and composition
Build 2017 - B8100 - What's new and coming for Windows UI: XAML and composition
 
Adobe AIR - Mobile Performance – Tips & Tricks
Adobe AIR - Mobile Performance – Tips & TricksAdobe AIR - Mobile Performance – Tips & Tricks
Adobe AIR - Mobile Performance – Tips & Tricks
 
Css3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQueryCss3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQuery
 
Silverlight 4 & Windows Phone 7 at Zup Zip Black Coffee#5
Silverlight 4 & Windows Phone 7 at Zup Zip Black Coffee#5Silverlight 4 & Windows Phone 7 at Zup Zip Black Coffee#5
Silverlight 4 & Windows Phone 7 at Zup Zip Black Coffee#5
 
Jimwebber soa
Jimwebber soaJimwebber soa
Jimwebber soa
 
Silverlight 2 For Developers
Silverlight 2 For DevelopersSilverlight 2 For Developers
Silverlight 2 For Developers
 
Dependency injection
Dependency injectionDependency injection
Dependency injection
 
Usman Shakeel - Cloud Rendering at Scale :: AWS Rendering Seminar
Usman Shakeel - Cloud Rendering at Scale :: AWS Rendering SeminarUsman Shakeel - Cloud Rendering at Scale :: AWS Rendering Seminar
Usman Shakeel - Cloud Rendering at Scale :: AWS Rendering Seminar
 
Crossroads of Asynchrony and Graceful Degradation
Crossroads of Asynchrony and Graceful DegradationCrossroads of Asynchrony and Graceful Degradation
Crossroads of Asynchrony and Graceful Degradation
 
Project SpaceLock - Architecture & Design
Project SpaceLock - Architecture & DesignProject SpaceLock - Architecture & Design
Project SpaceLock - Architecture & Design
 
Android RenderScript on LLVM
Android RenderScript on LLVMAndroid RenderScript on LLVM
Android RenderScript on LLVM
 
Microsoft silverlight
Microsoft silverlightMicrosoft silverlight
Microsoft silverlight
 
Understanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile BrowsersUnderstanding Hardware Acceleration on Mobile Browsers
Understanding Hardware Acceleration on Mobile Browsers
 

Mehr von rsnarayanan

Walther Aspnet4
Walther Aspnet4Walther Aspnet4
Walther Aspnet4
rsnarayanan
 
Walther Ajax4
Walther Ajax4Walther Ajax4
Walther Ajax4
rsnarayanan
 
Kevin Ms Web Platform
Kevin Ms Web PlatformKevin Ms Web Platform
Kevin Ms Web Platform
rsnarayanan
 
Harish Understanding Aspnet
Harish Understanding AspnetHarish Understanding Aspnet
Harish Understanding Aspnet
rsnarayanan
 
Walther Mvc
Walther MvcWalther Mvc
Walther Mvc
rsnarayanan
 
Harish Aspnet Dynamic Data
Harish Aspnet Dynamic DataHarish Aspnet Dynamic Data
Harish Aspnet Dynamic Data
rsnarayanan
 
Harish Aspnet Deployment
Harish Aspnet DeploymentHarish Aspnet Deployment
Harish Aspnet Deployment
rsnarayanan
 
Whats New In Sl3
Whats New In Sl3Whats New In Sl3
Whats New In Sl3
rsnarayanan
 
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
rsnarayanan
 
Occasionally Connected Systems
Occasionally Connected SystemsOccasionally Connected Systems
Occasionally Connected Systems
rsnarayanan
 
Developing Php Applications Using Microsoft Software And Services
Developing Php Applications Using Microsoft Software And ServicesDeveloping Php Applications Using Microsoft Software And Services
Developing Php Applications Using Microsoft Software And Services
rsnarayanan
 
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
rsnarayanan
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Library
rsnarayanan
 
Ms Sql Business Inteligence With My Sql
Ms Sql Business Inteligence With My SqlMs Sql Business Inteligence With My Sql
Ms Sql Business Inteligence With My Sql
rsnarayanan
 
Windows 7 For Developers
Windows 7 For DevelopersWindows 7 For Developers
Windows 7 For Developers
rsnarayanan
 
What Is New In Wpf 3.5 Sp1
What Is New In Wpf 3.5 Sp1What Is New In Wpf 3.5 Sp1
What Is New In Wpf 3.5 Sp1
rsnarayanan
 
Ux For Developers
Ux For DevelopersUx For Developers
Ux For Developers
rsnarayanan
 
A Lap Around Internet Explorer 8
A Lap Around Internet Explorer 8A Lap Around Internet Explorer 8
A Lap Around Internet Explorer 8
rsnarayanan
 
App Arch Guide (Dons)
App Arch Guide (Dons)App Arch Guide (Dons)
App Arch Guide (Dons)
rsnarayanan
 

Mehr von rsnarayanan (20)

Walther Aspnet4
Walther Aspnet4Walther Aspnet4
Walther Aspnet4
 
Walther Ajax4
Walther Ajax4Walther Ajax4
Walther Ajax4
 
Kevin Ms Web Platform
Kevin Ms Web PlatformKevin Ms Web Platform
Kevin Ms Web Platform
 
Harish Understanding Aspnet
Harish Understanding AspnetHarish Understanding Aspnet
Harish Understanding Aspnet
 
Walther Mvc
Walther MvcWalther Mvc
Walther Mvc
 
Harish Aspnet Dynamic Data
Harish Aspnet Dynamic DataHarish Aspnet Dynamic Data
Harish Aspnet Dynamic Data
 
Harish Aspnet Deployment
Harish Aspnet DeploymentHarish Aspnet Deployment
Harish Aspnet Deployment
 
Whats New In Sl3
Whats New In Sl3Whats New In Sl3
Whats New In Sl3
 
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
 
Netcf Gc
Netcf GcNetcf Gc
Netcf Gc
 
Occasionally Connected Systems
Occasionally Connected SystemsOccasionally Connected Systems
Occasionally Connected Systems
 
Developing Php Applications Using Microsoft Software And Services
Developing Php Applications Using Microsoft Software And ServicesDeveloping Php Applications Using Microsoft Software And Services
Developing Php Applications Using Microsoft Software And Services
 
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
Build Mission Critical Applications On The Microsoft Platform Using Eclipse J...
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Library
 
Ms Sql Business Inteligence With My Sql
Ms Sql Business Inteligence With My SqlMs Sql Business Inteligence With My Sql
Ms Sql Business Inteligence With My Sql
 
Windows 7 For Developers
Windows 7 For DevelopersWindows 7 For Developers
Windows 7 For Developers
 
What Is New In Wpf 3.5 Sp1
What Is New In Wpf 3.5 Sp1What Is New In Wpf 3.5 Sp1
What Is New In Wpf 3.5 Sp1
 
Ux For Developers
Ux For DevelopersUx For Developers
Ux For Developers
 
A Lap Around Internet Explorer 8
A Lap Around Internet Explorer 8A Lap Around Internet Explorer 8
A Lap Around Internet Explorer 8
 
App Arch Guide (Dons)
App Arch Guide (Dons)App Arch Guide (Dons)
App Arch Guide (Dons)
 

KĂŒrzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

KĂŒrzlich hochgeladen (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Advanced Silverlight

  • 1.
  • 2. Pandurang Nayak Sumeet Jindal Client Platform Evangelist Senior Developer Microsoft Corporation Vectorform
  • 3. Why are we here? Learn the inner workings of Silverlight Understand rendering pipelines Find tips and techniques for building great SL applications Learn performance best practices Understand how to profile your apps Peek into few advanced features in the upcoming Silverlight 3
  • 4. Information Sources Silverlight Performance Team Silverlight Product Team Top Silverlight Bloggers and Experts Internal MS Silverlight Communities My Own Experience with Customers
  • 5. Silverlight Architecture User Code Controls Managed Interop CoreC Property Deep Layout Text Media Gfx Zoom Image LR System Interaction between pipelines via brushes
  • 6. Graphics Pipeline Cross-Platform Develop once, run anywhere Retained Mode Graphics System dirty rectangle
  • 7. The UI Thread On The UI Thread On the Non-UI Thread User Code Frame Rasterization Control Code Media Decoding Animations Layout Master Tip Silverlight is hosted in the browser. So, the (single) UI Thread belongs to the browser!
  • 8. The Animate Loop Tick Event Handlers Ask browser Any Property to show Changes? frame By default, Rasterize in Layout back buffer Queue up Rendering Changes
  • 9. Animation Basics Frequency is the plugin’s framerate Real-Time Animation (vs. Frame-based) Types of animations: Interpolation Animations ColorAnimation, PointAnimation, DoubleAnimation Splines, KeyFrames ObjectAnimation http://silverlight.net/quickstarts/ blend_quickstart/part3_animations.aspx
  • 10. Knowing Animations We only redraw the dirty rectangle Avoid large scale animations Text redraw triggers the font hinting algorithm Master Tip When in doubt, use: agControl.settings.EnableRedrawRegions = true;
  • 12. The Update Loop Tick Event Handlers Ask browser Any Property to show Changes? frame Rasterize in Layout back buffer Queue up Rendering Changes
  • 13. Layout and Draw ListBox Designed for Nesting ScrollViewer Two Passes: Measure & Arrange Grid Extensible ScrollBars StackPanel Master ListBoxItem Tip Nested flow layout that changes often is expensive. Some Stuff
  • 14. The Update Loop Tick Event Handlers Ask browser Any Property to show Changes? frame Rasterize in Layout back buffer Queue up Rendering Changes
  • 15. Rasterization All changes for a frame are drawn at once Identify what causes a framerate drop Master Tip Measure maximum framerate to tune your application: sender.settings.EnableFramerateCounter = true; sender.settings.MaxFrameRate = 1000; Integrate codepaths via Brushes
  • 16. Brushes A brush maps a screen position to a color Brushes in Silverlight SolidColorBrush LinearGradientBrush RadialGradientBrush ImageBrush VideoBrush Master Tip When mixing pipelines, brushes are cheap!
  • 17. Image and Video Brushes in Silverlight
  • 18. Rasterization and Anti-Aliasing Vector Graphics - Anti-aliased Animation - Anti-aliased
  • 19. Rasterization and Anti-Aliasing Blurry Image Rendering Cause: Interpolation
  • 20. Rasterization and Anti-Aliasing Blurry Thin Lines Cause: non-int positions
  • 21. Rasterization and Anti-Aliasing Seaming Cause: non-int positions c = .5(.5*cbkgrd + .5*ctop) + .5(.5*cbkgrd + .5*cbottom)
  • 22. Rasterization and Anti-Aliasing In Silverlight 2 RTM, Vector Graphics ‱ Already Correct Behavior Animation ‱ Already Correct Behavior Image Rendering ‱ Layout Rounding NEW!!! Sharp Lines ‱ Layout Rounding NEW!!! ‱ Overlap edges Seaming ‱ Change Background Color Non-Integer positioning mainly arises from Text and “Center”
  • 23. Media Rendering halo.wmv is 300x400. Which is least expensive? <MediaElement Source=“halo.wmv” a. Width= quot;225quot; Height=quot;300quot; /> b. Width=quot;300quot; Height=quot;400quot; /> c. Width=quot;303quot; Height=quot;404quot; /> d. Width=quot;450quot; Height=quot;600quot; />
  • 24. Media: Every Pixel, Every frame! Rinse & Repeat, at the video framerate Encode at the minimum framerate that you need. Encode at the desired size Blending with media is expensive Master Tip Let the media pipeline decide the best framerate
  • 25. Media Rendering halo.wmv is 300x400. Which is least expensive? <MediaElement Source=“halo.wmv” a. Width= quot;225quot; Height=quot;300quot; /> b. Width=quot;300quot; Height=quot;400quot; /> c. Width=quot;303quot; Height=quot;404quot; /> d. Width=quot;450quot; Height=quot;600quot; />
  • 26. Media Rendering halo.wmv is 300x400. Which is least expensive? <MediaElement Source=“halo.wmv” a. Width= quot;225quot; Height=quot;300quot; /> b. Width=quot;300quot; Height=quot;400quot; /> c. Width=quot;303quot; Height=quot;404quot; /> d. Width=quot;450quot; Height=quot;600quot; />
  • 27. Shrinking video causes (Ex: 300x400 to 225x300) Extra bandwidth for extra 75x100px Decoding extra 75x100px Interpolation of every pixel in the 225x300 grid Pretty awesome interpolation, but never as good as native rendering
  • 28. Profiling Silverlight Applications Steps: 1. Observe 2. Hypothesize 3. Develop Testing Protocol 4. Experiment 5. Make Conclusion
  • 29. Debugging Settings Sys.Silverlight.createObjectEx({ source: quot;xaml/Scene.xamlquot;, parentElement: document.getElementById(quot;SilverlightControlHostquot;), id: quot;SilverlightControlquot;, properties: { width: quot;500quot;, height: quot;500quot;, isWindowless: false, background: quot;FF000000quot;, framerate: quot;10000quot; }, events: { onLoad:onLoadHandler} }); function onLoadHandler() { agControl = document.getElementById(quot;SilverlightControlquot;); /* To see the framerate displayed in the browser status bar */ agControl.settings.EnableFrameRateCounter = true; /* To see the redraw regions*/ agControl.settings.EnableRedrawRegions= true; }
  • 30. Your Animation is stuttering What is the first step to debug? a. Decrease the framerate b. Identify the resource constraint c. Turn on Redraw Regions Master Tip While debugging render issues, always try to identify what is blocking the UI thread.
  • 31. xperf ETW – Event Tracing for Windows Tracing mechanism for both user-mode & kernel- mode apps Silverlight & CLR have embedded ETW events Analyzes unmanaged callstack Describes CPU cycles over time
  • 32. xperf Step 1: Install Microsoft Windows Performance Toolkit http://msdn.microsoft.com/en-us/performance/default.aspx Step 2: Admin-level CMD prompt Step 3: xperf –on base Step 4: Run scenario try to make all parts fully visible. Step 5: xperf –d myprofile.etl Step 6: xperfview myprofile.etl (or open Performance Analyzer) Step 7: set _NT_SYMBOL_PATH= srv*C:symbols*http://msdl.microsoft.com/downloads/symbols Step 8: Trace > Load Symbols Step 9: Select Graph, right-click and choose Summary Step 10: Run again to make sure results were sampled correctly
  • 33. xperf
  • 34. What happens on Navigation Download Create Navigate Download JS HTML Plug-in Load Extract Launch Control.Source is XAP Assemblies Manifest CLR Create Object Set Visual App Creates Root Object Tree
  • 35. XAML Parsing Uncovered! URI-based resources are loaded when added to tree Asynch Cached via Browser Build unique tree for each Control Pull in Text Stack
  • 36. Text Stack TextBlock & TextBox Glyph Capabilities Text Stack Cross-OS consistency Glyph rendering is optimized for reading Anti-aliasing, H/V dropout, Gamma Correction These paths can be hit each tick if one is not careful Accepted Fonts Cross-OS, common set already on OS EA fonts, only if installed on machine
  • 37. Silverlight Spy View Visual Tree for Silverlight applications Along with .NET Reflector, can show you entire structure and code of Silverlight applications Master Tip Confidential stuff should always reside on server! ANYTHING on the client can be exposed.
  • 39. References Performance Bloggers http://blogs.msdn.com/seema http://blogs.microsoft.co.il/sasha http://blogs.msdn.com/tess/ http://blogs.technet.com/markrussinovich/ Silverlight Spy http://silverlightspy.com/
  • 40. Session Resources Windows Performance Toolkit: http://msdn.microsoft.com/en-us/performance Silverlight http://www.silverlight.net More Advanced Sessions http://2009.visitmix.com
  • 41.
  • 42.
  • 43. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Hinweis der Redaktion

  1. YUV to ARGB – Y (luminance), UV (chrominance)
  2. Silverlight provides a second lower level Glyphs element for advanced typography. A glyph is terminology indicating a graphical representation of a letter or sequence of letters.