SlideShare a Scribd company logo
1 of 23
WPF/ XamDataGrid
          Performance
Kiril Matev
Technical Evangelist
Infragistics, Inc
kmatev@infragistics.com
Contents
•   Application Resources
•   Layouts & Templates
•   Data Binding
•   Converter vs. DataTemplateSelector
•   XamDataGrid-specific optimizations
    – UI Virtualization
    – Themes and styles
    – Real-time updates
• Initial Loading Time (preloading and NGEN)
Application Resources
• Load relevant resources at the view level
  (as opposed to on the application level)
• Use shared resource definitions on the
  Window/Application level
• Use static resources rather than dynamic
  ones to save on lookups at runtime
Layouts & Templates
•   Reduce the number of visual elements
•   Use virtualized container with recycling
•   Refrain from using BitmapEffects
•   Set the neutral culture using
    NeutralResourcesLanguageAttribute to
    prevent lookup of satellite assemblies
Data Binding
• Fix binding errors to prevent expensive
  binding path resolutions
• Binding to many properties of an object is
  expensive compared to binding to few
  properties of many objects
• Test with 1000 textboxes
  – Bound to 1 object’s 1000 properties – 950ms
  – Bound to 1000 objects 1 property – 115ms
Data Binding
• Bind to IList rather than
  IEnumerable, because the CLR generates
  an IList to wrap it

• For adding/removing data from data
  sources, bind to ObservableCollection<T>
  rather than IList
Convertor vs DataTemplateSelector
• Use Convertors instead of
  DataTemplateSelectors
  – Added flexibility in specifying business logic
  – Slightly better performance
• For virtualized control, the convertors will
  be invoked for each cell coming into view,
• Apply processing in code-behind and bind
  to transformed/formatted data
Convertor Limitations
• For virtualized item controls, the
  conversion logic will be invoked for each
  cell coming into view
• Avoid unbound columns and convertors -
  apply processing in code-behind and bind
  to transformed data
• Apply formatting using styles rather than
  converters, e.g. date or time formatting
XamDataGrid UI Virtualization
• XamDataGrid supports virtualization
  modes on the row and column level to
  help you adjust performance for your
  specific scenarios
• You can customize the virtualization
  setting using the
  RecordContainerGenerationMode and
  CellContainerGenerationMode properties
XamDataGrid Virtualization Modes
• Recycle
  – Reuses the same visual elements, binding
    them to data items as they are scrolled into
    view
  – Minimize space requirement at the expense of
    time
  – Suitable for high-volume data scenarios with
    simple UI controls in the cells
XamDataGrid Virtualization Modes
• PreLoad
  – Initialize visual elements to represent the
    entire dataset
  – Improve runtime performance at the expense
    of space and startup time
  – Useful when you require smooth scrolling
    over a relatively small dataset, and you have
    user controls hosted in the control with
    expensive initialization/formatting applied
XamDataGrid Virtualization Modes
• LazyLoad
  – Initialize visual elements to represent the visible
    dataset, adding new ones to represent data
    subsequently brought into view
  – Minimum space at startup, increasing space
    footprint, accessing cells that have been in view
    is fast
  – Useful when you require smooth scrolling over a
    relatively small dataset, and you have user
    controls hosted in the control with expensive
    initialization/formatting applied
XamDataGrid Event Suppress
• Suppress unused routed events to
  improves performance due to the
  overhead incurred with routed events in
  element hierarchies.

• There are also direct CLR events added
  for common routed events on the
  DataPresenterBase.
XamDataGrid Themes & Styles
• Set the Theme property to prevent
  overhead in template lookup
  – Implications for preloading
• Use a hover-less theme to prevent row
  highlighting on mouse hover
XamDataGrid Real-Time Updates
• Using INotifyPropertyChanged on the
  property level (usual MVVM setup)
  – Useful for sparse updates, good for most cases
  – One event updates one bound column
• Using INotifyPropertyChanged on the row
  level
  – Useful for scenarios where all the properties in a
    row are changed. This updates the entire row
    using a single property changed notification,
    instead of raising N property changed events
  – One event updates an entire row
XamDataGrid Real-Time Updates
• Using CollectionChanged.Reset for
  frequent and extensive data updates
  – Useful for scenarios where the underlying
    datasource changes dramatically – e.g. a new
    batch of rows come in from a backend system
  – One event updates the entire grid
XamDataGrid ReadOnly Style
• Using the read-only cell style (provided on
  my blog), you can get a radically simpler
  CellValuePresenter style, which improves
  performance
• It does not render editors for cells in edit
  mode,
• Setting EditAsType the same type for all
  XamDataGrid fields facilitates cell
  virtualization
Initial Loading Time - Preloading
• Preloading XamDataGrid (and any other
  Infragistics controls) in a window not
  shown to the user pays upfront the cost of
  JIT-compiling the XamDataGrid
• This causes user-initiated opening of a
  window containing the XamDataGrid to be
  much faster
• Approach is described here
Initial Loading Time - NGEN
• The JIT compiler compiles methods as
  required during execution
  – Takes up CPU time
  – Compiled code cannot be shared among
    processes
Initial Loading Time - NGEN
• Using NGEN to create pre-compiled (native)
  images of Infragistics DLLs to eliminate JIT-
  compilation
  – Reduces the memory footprint
     • JIT compiler does not need to be loaded in memory)
     • Native images can be shared among processes
  – Improves loading time in warm startup scenarios
  Note: NGEN’ed assemblies need to be in the
  GAC on the client machine in order to avoid
  costly strong-name validation procedure.
Questions
Resources
Optimizing XamDataGrid performance
http://blogs.infragistics.com/blogs/kiril_matev/archive/2010/10/26/optimizing-xamdatagrid-
performance.aspx

Optimizing WPF Application Performance
http://msdn.microsoft.com/en-us/library/aa970683.aspx
Contacts
kmatev@infragistics.com

More Related Content

Viewers also liked

Indian German Unity
Indian German UnityIndian German Unity
Indian German UnityAnkit Singh
 
Amran Tuberi - the damage of cycling to the desert ecosystem
Amran Tuberi - the damage of cycling to the desert ecosystemAmran Tuberi - the damage of cycling to the desert ecosystem
Amran Tuberi - the damage of cycling to the desert ecosystemEngineering Software Lab
 
Parasoft Concerto A complete ALM platform that ensures quality software can b...
Parasoft Concerto A complete ALM platform that ensures quality software can b...Parasoft Concerto A complete ALM platform that ensures quality software can b...
Parasoft Concerto A complete ALM platform that ensures quality software can b...Engineering Software Lab
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis Engineering Software Lab
 
Perforce עשרת היתרונות המובילים של מערכת ניהול התצורה
Perforce עשרת היתרונות המובילים של מערכת ניהול התצורהPerforce עשרת היתרונות המובילים של מערכת ניהול התצורה
Perforce עשרת היתרונות המובילים של מערכת ניהול התצורהEngineering Software Lab
 
Nunit C# source code defects report by Parasoft dotTEST
Nunit  C# source code  defects report by Parasoft dotTEST Nunit  C# source code  defects report by Parasoft dotTEST
Nunit C# source code defects report by Parasoft dotTEST Engineering Software Lab
 
Code coverage in theory and in practice form the do178 b perspective
Code coverage in theory and in practice form the do178 b perspectiveCode coverage in theory and in practice form the do178 b perspective
Code coverage in theory and in practice form the do178 b perspectiveEngineering Software Lab
 
CppUnit using introduction
CppUnit using introductionCppUnit using introduction
CppUnit using introductionIurii Kyian
 
Unit testing on embedded target with C++Test
Unit testing on embedded  target with C++TestUnit testing on embedded  target with C++Test
Unit testing on embedded target with C++TestEngineering Software Lab
 
Code Coverage in Theory and in practice form the DO178B perspective
Code Coverage in Theory and in practice form the DO178B perspective   Code Coverage in Theory and in practice form the DO178B perspective
Code Coverage in Theory and in practice form the DO178B perspective Engineering Software Lab
 

Viewers also liked (19)

Indian German Unity
Indian German UnityIndian German Unity
Indian German Unity
 
A Scalable Software Build Accelerator
A Scalable Software Build AcceleratorA Scalable Software Build Accelerator
A Scalable Software Build Accelerator
 
המסדרת הפכה למגוהצת
המסדרת הפכה למגוהצתהמסדרת הפכה למגוהצת
המסדרת הפכה למגוהצת
 
Amran Tuberi - the damage of cycling to the desert ecosystem
Amran Tuberi - the damage of cycling to the desert ecosystemAmran Tuberi - the damage of cycling to the desert ecosystem
Amran Tuberi - the damage of cycling to the desert ecosystem
 
Parasoft Concerto A complete ALM platform that ensures quality software can b...
Parasoft Concerto A complete ALM platform that ensures quality software can b...Parasoft Concerto A complete ALM platform that ensures quality software can b...
Parasoft Concerto A complete ALM platform that ensures quality software can b...
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
 
Perforce עשרת היתרונות המובילים של מערכת ניהול התצורה
Perforce עשרת היתרונות המובילים של מערכת ניהול התצורהPerforce עשרת היתרונות המובילים של מערכת ניהול התצורה
Perforce עשרת היתרונות המובילים של מערכת ניהול התצורה
 
Parasoft fda software compliance part2
Parasoft fda software compliance   part2Parasoft fda software compliance   part2
Parasoft fda software compliance part2
 
Introduction to Parasoft C++TEST
Introduction to Parasoft C++TEST Introduction to Parasoft C++TEST
Introduction to Parasoft C++TEST
 
Nunit C# source code defects report by Parasoft dotTEST
Nunit  C# source code  defects report by Parasoft dotTEST Nunit  C# source code  defects report by Parasoft dotTEST
Nunit C# source code defects report by Parasoft dotTEST
 
Parasoft fda software compliance part1
Parasoft fda software compliance   part1Parasoft fda software compliance   part1
Parasoft fda software compliance part1
 
Palamida Open Source Compliance Solution
Palamida Open Source Compliance Solution Palamida Open Source Compliance Solution
Palamida Open Source Compliance Solution
 
Code coverage in theory and in practice form the do178 b perspective
Code coverage in theory and in practice form the do178 b perspectiveCode coverage in theory and in practice form the do178 b perspective
Code coverage in theory and in practice form the do178 b perspective
 
FDA software compliance 2016
FDA software compliance 2016FDA software compliance 2016
FDA software compliance 2016
 
CppUnit using introduction
CppUnit using introductionCppUnit using introduction
CppUnit using introduction
 
Unit testing on embedded target with C++Test
Unit testing on embedded  target with C++TestUnit testing on embedded  target with C++Test
Unit testing on embedded target with C++Test
 
Embedded System Test Automation
Embedded System Test AutomationEmbedded System Test Automation
Embedded System Test Automation
 
Code Coverage in Theory and in practice form the DO178B perspective
Code Coverage in Theory and in practice form the DO178B perspective   Code Coverage in Theory and in practice form the DO178B perspective
Code Coverage in Theory and in practice form the DO178B perspective
 
Cpp unit
Cpp unit Cpp unit
Cpp unit
 

Similar to Optimize XamDataGrid Performance

Architectures, Frameworks and Infrastructure
Architectures, Frameworks and InfrastructureArchitectures, Frameworks and Infrastructure
Architectures, Frameworks and Infrastructureharendra_pathak
 
State management 1
State management 1State management 1
State management 1singhadarsh
 
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at UberWSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at UberWSO2
 
MongoDB at MapMyFitness
MongoDB at MapMyFitnessMongoDB at MapMyFitness
MongoDB at MapMyFitnessMapMyFitness
 
ASP.NET Scalability - DDD7
ASP.NET Scalability - DDD7ASP.NET Scalability - DDD7
ASP.NET Scalability - DDD7Phil Pursglove
 
Real time architecture big data
Real time architecture big dataReal time architecture big data
Real time architecture big dataSanjeev Solanki
 
Running Java Applications inside Kubernetes with Nested Container Architectur...
Running Java Applications inside Kubernetes with Nested Container Architectur...Running Java Applications inside Kubernetes with Nested Container Architectur...
Running Java Applications inside Kubernetes with Nested Container Architectur...Jelastic Multi-Cloud PaaS
 
Development of concurrent services using In-Memory Data Grids
Development of concurrent services using In-Memory Data GridsDevelopment of concurrent services using In-Memory Data Grids
Development of concurrent services using In-Memory Data Gridsjlorenzocima
 
Simulating Heterogeneous Resources in CloudLightning
Simulating Heterogeneous Resources in CloudLightningSimulating Heterogeneous Resources in CloudLightning
Simulating Heterogeneous Resources in CloudLightningCloudLightning
 
Prediction as a service with ensemble model in SparkML and Python ScikitLearn
Prediction as a service with ensemble model in SparkML and Python ScikitLearnPrediction as a service with ensemble model in SparkML and Python ScikitLearn
Prediction as a service with ensemble model in SparkML and Python ScikitLearnJosef A. Habdank
 
ASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordPhil Pursglove
 
Webinar: SQL for Machine Data?
Webinar: SQL for Machine Data?Webinar: SQL for Machine Data?
Webinar: SQL for Machine Data?Crate.io
 
Graphene – Microsoft SCOPE on Tez
Graphene – Microsoft SCOPE on Tez Graphene – Microsoft SCOPE on Tez
Graphene – Microsoft SCOPE on Tez DataWorks Summit
 
Data has a better idea the in-memory data grid
Data has a better idea   the in-memory data gridData has a better idea   the in-memory data grid
Data has a better idea the in-memory data gridBogdan Dina
 
Nuts and bolts of running a popular site in the aws cloud
Nuts and bolts of running a popular site in the aws cloudNuts and bolts of running a popular site in the aws cloud
Nuts and bolts of running a popular site in the aws cloudDavid Veksler
 
High Performance Computing with AWS
High Performance Computing with AWSHigh Performance Computing with AWS
High Performance Computing with AWSAmazon Web Services
 
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...SQUADEX
 
C* Summit 2013: Large Scale Data Ingestion, Processing and Analysis: Then, No...
C* Summit 2013: Large Scale Data Ingestion, Processing and Analysis: Then, No...C* Summit 2013: Large Scale Data Ingestion, Processing and Analysis: Then, No...
C* Summit 2013: Large Scale Data Ingestion, Processing and Analysis: Then, No...DataStax Academy
 
IBM Maximo Performance Tuning
IBM Maximo Performance TuningIBM Maximo Performance Tuning
IBM Maximo Performance TuningFMMUG
 

Similar to Optimize XamDataGrid Performance (20)

Architectures, Frameworks and Infrastructure
Architectures, Frameworks and InfrastructureArchitectures, Frameworks and Infrastructure
Architectures, Frameworks and Infrastructure
 
State management 1
State management 1State management 1
State management 1
 
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at UberWSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
WSO2Con USA 2017: Scalable Real-time Complex Event Processing at Uber
 
MongoDB at MapMyFitness
MongoDB at MapMyFitnessMongoDB at MapMyFitness
MongoDB at MapMyFitness
 
ASP.NET Scalability - DDD7
ASP.NET Scalability - DDD7ASP.NET Scalability - DDD7
ASP.NET Scalability - DDD7
 
Real time architecture big data
Real time architecture big dataReal time architecture big data
Real time architecture big data
 
Running Java Applications inside Kubernetes with Nested Container Architectur...
Running Java Applications inside Kubernetes with Nested Container Architectur...Running Java Applications inside Kubernetes with Nested Container Architectur...
Running Java Applications inside Kubernetes with Nested Container Architectur...
 
Development of concurrent services using In-Memory Data Grids
Development of concurrent services using In-Memory Data GridsDevelopment of concurrent services using In-Memory Data Grids
Development of concurrent services using In-Memory Data Grids
 
Simulating Heterogeneous Resources in CloudLightning
Simulating Heterogeneous Resources in CloudLightningSimulating Heterogeneous Resources in CloudLightning
Simulating Heterogeneous Resources in CloudLightning
 
Prediction as a service with ensemble model in SparkML and Python ScikitLearn
Prediction as a service with ensemble model in SparkML and Python ScikitLearnPrediction as a service with ensemble model in SparkML and Python ScikitLearn
Prediction as a service with ensemble model in SparkML and Python ScikitLearn
 
ASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen Oxford
 
Webinar: SQL for Machine Data?
Webinar: SQL for Machine Data?Webinar: SQL for Machine Data?
Webinar: SQL for Machine Data?
 
Operational-Analytics
Operational-AnalyticsOperational-Analytics
Operational-Analytics
 
Graphene – Microsoft SCOPE on Tez
Graphene – Microsoft SCOPE on Tez Graphene – Microsoft SCOPE on Tez
Graphene – Microsoft SCOPE on Tez
 
Data has a better idea the in-memory data grid
Data has a better idea   the in-memory data gridData has a better idea   the in-memory data grid
Data has a better idea the in-memory data grid
 
Nuts and bolts of running a popular site in the aws cloud
Nuts and bolts of running a popular site in the aws cloudNuts and bolts of running a popular site in the aws cloud
Nuts and bolts of running a popular site in the aws cloud
 
High Performance Computing with AWS
High Performance Computing with AWSHigh Performance Computing with AWS
High Performance Computing with AWS
 
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
Tooling for Machine Learning: AWS Products, Open Source Tools, and DevOps Pra...
 
C* Summit 2013: Large Scale Data Ingestion, Processing and Analysis: Then, No...
C* Summit 2013: Large Scale Data Ingestion, Processing and Analysis: Then, No...C* Summit 2013: Large Scale Data Ingestion, Processing and Analysis: Then, No...
C* Summit 2013: Large Scale Data Ingestion, Processing and Analysis: Then, No...
 
IBM Maximo Performance Tuning
IBM Maximo Performance TuningIBM Maximo Performance Tuning
IBM Maximo Performance Tuning
 

Recently uploaded

Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 

Recently uploaded (20)

Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 

Optimize XamDataGrid Performance

  • 1. WPF/ XamDataGrid Performance Kiril Matev Technical Evangelist Infragistics, Inc kmatev@infragistics.com
  • 2. Contents • Application Resources • Layouts & Templates • Data Binding • Converter vs. DataTemplateSelector • XamDataGrid-specific optimizations – UI Virtualization – Themes and styles – Real-time updates • Initial Loading Time (preloading and NGEN)
  • 3. Application Resources • Load relevant resources at the view level (as opposed to on the application level) • Use shared resource definitions on the Window/Application level • Use static resources rather than dynamic ones to save on lookups at runtime
  • 4. Layouts & Templates • Reduce the number of visual elements • Use virtualized container with recycling • Refrain from using BitmapEffects • Set the neutral culture using NeutralResourcesLanguageAttribute to prevent lookup of satellite assemblies
  • 5. Data Binding • Fix binding errors to prevent expensive binding path resolutions • Binding to many properties of an object is expensive compared to binding to few properties of many objects • Test with 1000 textboxes – Bound to 1 object’s 1000 properties – 950ms – Bound to 1000 objects 1 property – 115ms
  • 6. Data Binding • Bind to IList rather than IEnumerable, because the CLR generates an IList to wrap it • For adding/removing data from data sources, bind to ObservableCollection<T> rather than IList
  • 7. Convertor vs DataTemplateSelector • Use Convertors instead of DataTemplateSelectors – Added flexibility in specifying business logic – Slightly better performance • For virtualized control, the convertors will be invoked for each cell coming into view, • Apply processing in code-behind and bind to transformed/formatted data
  • 8. Convertor Limitations • For virtualized item controls, the conversion logic will be invoked for each cell coming into view • Avoid unbound columns and convertors - apply processing in code-behind and bind to transformed data • Apply formatting using styles rather than converters, e.g. date or time formatting
  • 9. XamDataGrid UI Virtualization • XamDataGrid supports virtualization modes on the row and column level to help you adjust performance for your specific scenarios • You can customize the virtualization setting using the RecordContainerGenerationMode and CellContainerGenerationMode properties
  • 10. XamDataGrid Virtualization Modes • Recycle – Reuses the same visual elements, binding them to data items as they are scrolled into view – Minimize space requirement at the expense of time – Suitable for high-volume data scenarios with simple UI controls in the cells
  • 11. XamDataGrid Virtualization Modes • PreLoad – Initialize visual elements to represent the entire dataset – Improve runtime performance at the expense of space and startup time – Useful when you require smooth scrolling over a relatively small dataset, and you have user controls hosted in the control with expensive initialization/formatting applied
  • 12. XamDataGrid Virtualization Modes • LazyLoad – Initialize visual elements to represent the visible dataset, adding new ones to represent data subsequently brought into view – Minimum space at startup, increasing space footprint, accessing cells that have been in view is fast – Useful when you require smooth scrolling over a relatively small dataset, and you have user controls hosted in the control with expensive initialization/formatting applied
  • 13. XamDataGrid Event Suppress • Suppress unused routed events to improves performance due to the overhead incurred with routed events in element hierarchies. • There are also direct CLR events added for common routed events on the DataPresenterBase.
  • 14. XamDataGrid Themes & Styles • Set the Theme property to prevent overhead in template lookup – Implications for preloading • Use a hover-less theme to prevent row highlighting on mouse hover
  • 15. XamDataGrid Real-Time Updates • Using INotifyPropertyChanged on the property level (usual MVVM setup) – Useful for sparse updates, good for most cases – One event updates one bound column • Using INotifyPropertyChanged on the row level – Useful for scenarios where all the properties in a row are changed. This updates the entire row using a single property changed notification, instead of raising N property changed events – One event updates an entire row
  • 16. XamDataGrid Real-Time Updates • Using CollectionChanged.Reset for frequent and extensive data updates – Useful for scenarios where the underlying datasource changes dramatically – e.g. a new batch of rows come in from a backend system – One event updates the entire grid
  • 17. XamDataGrid ReadOnly Style • Using the read-only cell style (provided on my blog), you can get a radically simpler CellValuePresenter style, which improves performance • It does not render editors for cells in edit mode, • Setting EditAsType the same type for all XamDataGrid fields facilitates cell virtualization
  • 18. Initial Loading Time - Preloading • Preloading XamDataGrid (and any other Infragistics controls) in a window not shown to the user pays upfront the cost of JIT-compiling the XamDataGrid • This causes user-initiated opening of a window containing the XamDataGrid to be much faster • Approach is described here
  • 19. Initial Loading Time - NGEN • The JIT compiler compiles methods as required during execution – Takes up CPU time – Compiled code cannot be shared among processes
  • 20. Initial Loading Time - NGEN • Using NGEN to create pre-compiled (native) images of Infragistics DLLs to eliminate JIT- compilation – Reduces the memory footprint • JIT compiler does not need to be loaded in memory) • Native images can be shared among processes – Improves loading time in warm startup scenarios Note: NGEN’ed assemblies need to be in the GAC on the client machine in order to avoid costly strong-name validation procedure.