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 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. While we are invested in supporting the latest version of .NET, we also support many developers using .NET Framework for their desktop applications.

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 third-party controls. Let's discover how the latest versions of all grids compare with each other.

Try ComponentOne Studio

Download the latest version of ComponentOne Studio Enterprise

Download Now!

WPF Datagrids Tested

This benchmark was created in December 2021 using these datagrid controls:

We used the latest trial versions of NuGet packages available for download. Please note that Telerik only supports local NuGet packages and DevExpress has its own NuGet server. Other references can be updated from http://nuget.org/. Some vendors require you to request a 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 a visual tree, and fills it with data. The test shows how long it takes to load a datagrid with data, including JIT compilation and XAML parsing. Here we see FlexGrid for WPF and WinForms is the best at initial load time:

time

Batch Operations

These 2 benchmarks show the use case when 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:

batch

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:

data

Scrolling

Scrolling is an operation that every single user performs, so it's important to be fast and smooth. For the benchmark, we used methods that scroll some specific data rows 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:

scrolling

Column Operations

The benchmarks for column operations were implemented by sorting, filtering, and grouping the underlying CollectionView. Here we see the WPF FlexGrid has an average performance for 10,000 rows:

operations

The above images only show some of the results. You can get more numbers from links at the bottom or download benchmark source code and play with the 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.

Conclusion

Across the tests, we see how FlexGrid for WPF stacks up against the competition. FlexGrid is one of the best WPF datagrids for loading large data sets and performing batch operations, with 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 a more detailed description of individual tests and benchmark applications here:

Stay tuned. Our next benchmark will be about .NET 6 datagrids!

Try ComponentOne Studio

Download the latest version of ComponentOne Studio Enterprise

Download Now!