WPF Datagrid Performance Comparison for .NET 6

In our previous blog, we shared performance results for the latest .NET Framework WPF datagrids. In this blog we will compare how different datagrids perform in .NET 6. 

We are committed to continuously look for better strategies to improve the performance of every control we create. When we migrated FlexGrid to .NET 5, we redesigned some internal aspects to overcome some bottlenecks and take advantage of the new framework. Lately, we migrated the .NET 5 FlexGrid to .NET 6 where it will receive longer support as Microsoft is committing to 3 years of support for .NET 6 compared to just one for .NET 5. So we want to see how the performance is for .NET 6 compared to .NET 5. 

.NET 6 Datagrids Tested

In this performance comparison we looked at the following .NET 6 WPF datagrid controls: 

We included the WinForms FlexGrid just to see how the desktop platforms compare with each other. The benchmark application has changes compared to the previous .NET Framework application in public APIs and namespaces. We used the latest trial versions of NuGet packages available for downloading as of December 2021. 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.

WPF Datagrid Performance

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.

WPF Datagrid Performance

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.

WPF Datagrid Performance

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.

WPF Datagrid Performance

Note: FlexGrid for WPF and DevExpress GridControl have scrolling animations. For the sake of benchmarking, animations have been disabled.

Column Operations

The benchmarks for column operations were implemented by sorting, filtering and grouping the underlying CollectionView. Here we see the WPF FlexGrid has very good performance.

WPF Datagrid Performance

Note: FlexGrid for WPF and DevExpress GridControl have expand group animations and some controls collapse groups by default. For the sake of benchmarking, animations have been disabled and all controls have been set to expand all groups.

The 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. Attached test application has changes comparing with .Net Framework benchmarks in public APIs and namespaces. 

Conclusion

Across the tests we can see how the .NET 6 FlexGrid for WPF stacks up against the competition. We see FlexGrid is one of the best WPF datagrids for loading large data sets, performing batch operations and column operations. FlexGrid has average results for scrolling. 

Please note that not all libraries used in this test were built for .NET 6:

  • DevExpress library targets .Net Core 3.0.
  • Syncfusion and Infragistics libraries target .Net 5.
  • C1Excel library used for logging targets .Net Framework 4.5.2.

The good news is that all libraries just work in .NET 6 environment regardless of targeted .NET Framework or .NET versions.

There is no Xceed datagrid for .NET 6, so they are excluded.

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:

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. 

comments powered by Disqus