WPF Datagrid Performance Comparison for 2022
Performance is one of the most important considerations when developing a .NET datagrid control. The datagrid is one of the most versatile controls for displaying, editing and analyzing data, so it must perform well enough to handle our entire dataset. We are always looking at how to improve the performance of our flagship FlexGrid control across every .NET platform.
When we migrated FlexGrid to .NET 5, we redesigned some internal aspects to overcome some bottlenecks and take advantage of the new framework. But while we are invested in supporting the latest version of .NET, we also support many developers using .NET Framework for their desktop application.
In this blog, we will look at the performance of our .NET Framework 4.5.2 FlexGrid control for WPF and compare it to the standard datagrid as well as some other 3rd party controls. Let's check how the latest versions of all grids compare with each other.
WPF Datagrids Tested
This benchmark was created in December 2021 using these datagrid controls:
- DataGrid control from System.Windows.Controls (the part of PresentationFramework.dll)
- C1.WPF.FlexGrid.4.5.2.4.5.20213.755 (ComponentOne WPF Edition)
- C1.WPF.DataGrid.4.5.2.4.5.20213.755 (ComponentOne WPF Edition)
- C1.Win.C1FlexGrid.4.5.2.4.5.20213.534 (ComponentOne WinForms Edition)
- InfragisticsWPF.DataPresenter.21.1.20211.49 (Infragistics Ultimate UI for WPF)
- DevExpress.Xpf.Grid.v21.2.21.2.4.0 (The DevExpress WPF Subscription)
- Syncfusion.SfGrid.WPF.19.3460.0.57 (Syncfusion WPF Controls)
- Telerik.Windows.Controls.GridView.2021.3.1109.45 (Telerik UI for WPF)
- Xceed.Wpf.DataGrid.v7.0.7.0.21122.9580 (Xceed DataGrid for WPF)
We used the latest trial versions of NuGet packages available for downloading. Please note that Telerik only supports local Nuget packages and DevExpress has own NuGet server. Other references can be updated from http://nuget.org/. Some vendors require you to request trial license from the active account on their site. .
Test Results
Initial Load Time
This benchmark creates a user control containing a tested datagrid, inserts it into visual tree, and fills with data. The test shows how long it takes to load a data grid with data including JIT compilation and XAML parsing. Here we see FlexGrid for WPF and WinForms is the best at initial load time.
Batch Operations
These 2 benchmarks show the use case when a 1,000 items are added to or removed from datagrid in a single batch operation. For some grids it's very time consuming, so we only performed this test for 1,000 rows. Here we see FlexGrid is only outperformed by the Microsoft Datagrid.
Reloading Data
This benchmark sets the datagrid's ItemsSource to null to clear both data and autogenerated columns, and then sets ItemsSource again to reload data. Here we see once again that FlexGrid is the best for loading large data sets.
Scrolling
Scrolling is an operation which every single user perform, so it's important to be fast and smooth. For the benchmark we used methods which scroll some specific data row into the view. All grids have some implementation for this. Here we see FlexGrid for WPF is slower than the WinForms version but average across the WPF datagrids.
Column Operations
The benchmarks for column operations were implemented by sorting, filtering and grouping the underlying CollectionView. Here we see the WPF FlexGrid has average performance for 10,000 rows.
Above images only show some of results. You can get more numbers from links in the bottom or download benchmark source code and play with tests.
Testing Environment
The benchmarks were run on HP EliteOne 800 G5 All-in-One Desktop with next parameters:
Processor Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19 GHz
Installed RAM 16,0 GB (15,8 GB usable)
Radeon RX 560X Series, Full HD (1920 x 1080) resolution
System type 64-bit operating system, x64-based processor
Edition Windows 10 Pro Version 20H2
All grids were set to equal size, the default appearance and similar options about column sizing, grouping, etc.
- Download WPFGridsBenchmark source code (19 KB zip)
- Download test results for 1000 rows (25 KB xls)
- Download test results for 10 000 rows (11 KB xls)
- Download test results for 100 000 rows (10 KB xls)
Conclusion
Across the tests we can see how FlexGrid for WPF stacks up against the competition. We see FlexGrid is one of the best WPF datagrids for loading large data sets and performing batch operations. FlexGrid has average results for scrolling and column operations.
For a historical comparison, we shared similar performance comparisons in 2016 and 2017. Since then we've updated the benchmark application for more accurate measuring. We also made code changes for some datagrids to reflect improvements in public APIs. You can find more detailed description of individual tests and benchmark application here:
Stay tuned, our next benchmark will be about .Net 6 data grids!
Update, January 2022: The benchmark code and test results have been updated to wrap batch operations into BeginDataUpdate/EndDataUpdate calls of the DevExpress.Xpf.Grid.GridControl.