67

Dramatically increase performance for large amounts of data in Xaml GridView and ListView

  • Upload
    asabi

  • View
    41

  • Download
    0

Embed Size (px)

DESCRIPTION

Dramatically increase performance for large amounts of data in Xaml GridView and ListView. Chipalo Street Program Manager II 3-158. Agenda. Panning Item virtualization Placeholder elements Incremental update Startup Presenter elements Customizing presenters. Panning . - PowerPoint PPT Presentation

Citation preview

Page 1: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView
Page 2: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Dramatically increase performance for large amounts of data in Xaml GridView and ListViewChipalo StreetProgram Manager II3-158

Page 3: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning• Item virtualization • Placeholder elements• Incremental update

Startup• Presenter elements• Customizing presenters

Agenda

Page 4: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning

Page 5: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Data template vs. item container template

Page 6: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Data template vs. item container template

Page 7: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Data template vs. item container template

Page 8: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning perf overview

Page 9: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning perf overview

Page 10: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning perf overview

Page 11: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning perf overview

Page 12: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning perf overview – UI virtualization

Page 13: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning perf overview – UI virtualization

Page 14: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Use ItemsStackPanel or ItemsWrapGrid to get item virtualization. The framework automatically does this for all apps that use the default ItemsPanel.

Page 15: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Item virtualization improvements

Page 16: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning perf overview

Page 17: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning perf overview

UI thread work

Page 18: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning perf overview

render item 21

Page 19: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning perf overview

render item 22

Page 20: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Panning perf overview

render item 23

Page 21: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

<GridView ShowsScrollingPlaceholders="true“>

Placeholders increase perceived performance

Page 22: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

All apps running on Windows 8.1 get placeholders for free.

Page 23: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Perf improvement from placeholders

Page 24: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Incrementally updating the data template

Page 25: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Incrementally updating the data template

UI thread work

Page 26: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Incrementally updating the data template

UI thread work

Page 27: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Incrementally updating the data template

phase 0

Page 28: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Incrementally updating the data template

phase 1

Page 29: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Incrementally updating the data template

phase 2

Page 30: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Incrementally updating the data template

UI thread work

Page 31: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Incrementally updating the data template

phase 0

Page 32: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Incrementally updating the data template

phase 1

Page 33: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Incrementally updating the data template

phase 2

Page 34: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Incrementally updating the data template

phase 2

Page 35: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Incrementally updating the data template

phase 3

Page 36: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

ContainerContentChanging<GridView ContainerContentChanging=“YourCCCEventHandler“>

ContainerContentChanging args• Phase• RegisterUpdateCallback• Handled• ItemContainer• Item• InRecycleQueue• ItemIndex

Page 37: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Consider implementing incremental updating for scenarios when rendering items is expensive.

Page 38: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Using ContainerContentChanging to implement incremental updating

Page 39: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Startup

Page 40: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Data template vs. item container template

Page 41: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Data template vs. item container template

Page 42: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Data template vs. item container template

Page 43: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Win 8 item container templates are expensive

Page 44: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Win 8 item container templates are expensive

Page 45: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Win 8 item container templates are expensive

Page 46: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Win 8 item container templates are expensive

Page 47: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Many items exacerbate problem1050 objects created for state alone!

Page 48: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Item presenters

Windows 8 Windows 8.1

Page 49: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

All apps that use default item container visuals start up to 26% faster when running on Windows 8.1

Page 50: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Use presenters in customized item container templates

<GridViewItemPresenterSelectionChecMarkVisualEnabled=“False”SelectionBackground=“#FFFF8c00”SeletionBorderThickness=“5” />

+ =

Page 51: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Use presenters in customized item container templates to get start up improvements on Windows 8.1

Page 52: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Migrating to GridViewItemPresenter

Page 53: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Default✘✘

Structural item container template customization

Customized

Page 54: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Build visual tree with GoToElementStateCore

Page 55: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Build visual tree with GoToElementStateCore

Page 56: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Build visual tree with GoToElementStateCore

Page 57: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Build visual tree with GoToElementStateCore

Page 58: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Build visual tree with GoToElementStateCore

Customization via GoToElementStateCore

Customization via Windows 8 template

Page 59: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Building a visual tree on demand of customized item container templates results in better startup performance and reduced memory overhead.

Page 60: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Review – Item virtualization

Default ItemsPanel Custom ItemsPanelWindows 8 Recompile app for

8.1Change to new panel

Windows 8.1 FREE! Change to new panel

Faster startup and faster item presentation

Page 61: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Review – Placeholders

Improves perceived performance

Free for all apps!

Page 62: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Review – Incremental updateIncrementally update all items instead of fully rendering a few

Windows 8 – N/A

Windows 8.1 – Use ContainerContentChanging

Page 63: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Default ItemContainerStyle

Custom ItemContainerStyle

Windows 8 Recompile app for 8.1

Change template to use presenters

Windows 8.1 FREE!

Change template to use presenters

Review – Presenters

✔Improve startup by up to 26%

Page 64: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Review – GoToElementStateCoreImprove startup by up to 26%

Windows 8 – N/A

Windows 8.1 – Use GoToElementStateCore

Page 65: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

ResourcesNotes in the slides!3-157 Xaml Performance Fundamentals3-403 App Performance: The Mental Model for Interacting with the Platform3-099 App Performance: From UX to API for 5 Key Scenarios2-100 App Performance: The Windows Performance Toolkit2-098 App Performance: Planning Costs Less Than Architectinghttp://aka.ms.fastxaml

Page 66: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

Evaluate this session

Scan this QR code to evaluate this session and be automatically entered in a drawing to win a prize!

Page 67: Dramatically increase performance for large amounts of data in  Xaml GridView  and  ListView

© 2012 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.