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.18.104.22.168.5.20213.755 (ComponentOne WPF Edition)
- C1.WPF.DataGrid.22.214.171.124.5.20213.755 (ComponentOne WPF Edition)
- C1.Win.C1FlexGrid.126.96.36.199.5.20213.534 (ComponentOne WinForms Edition)
- InfragisticsWPF.DataPresenter.21.1.20211.49 (Infragistics Ultimate UI for WPF)
- DevExpress.Xpf.Grid.v188.8.131.52.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.v184.108.40.206.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. .
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.
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.
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 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.
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.
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)
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.