Changes in WPF DataGrid Performance Test Application
We made some changes in the test application to get more accurate results:
- Used more strict garbage collection options between tests
- Excluded ListCollectionView creation from time measurement
- Used ListCollectionView.DeferRefresh when doing several changes for single tests, including clearing SortDescriptions and assigning new ones
Full source code is attached so you can check how it all works.
New Filter Column Test
New filtering test uses filter predicate to filter grid by IsActive column:
public async override Task Filter(bool isActive)
var cv = _grid.ItemsSource as ListCollectionView;
if (cv != null)
cv.Filter = IsActiveFilter;
cv.Filter = IsInactiveFilter;
New Group by Single Column Test
New grouping test uses ICollectionView.GroupDescriptions to group grid by CountryID field:
public override async Task Group()
ICollectionView cv = _grid.ItemsSource as ICollectionView;
Note: it's important to use DeferRefresh. Otherwise, it will take more time.
When running this test you'll see that MS DataGrid doesn't actually support this scenario and doesn't show group rows. But it does reflect changes in underlying data source, so we decided to leave it as is.
Compare with WinForms FlexGrid
FlexGrid is one of our oldest and popular .NET controls, and we have it in all our editions. So we decided to include WinForms version into this test to get more-or-less comparable numbers and see whether WPF version is comparable with it by performance. In this test we had to use WindowsFormsHost with solid background. Note, by default, WindowsFormsHost.Background is transparent and it gives a huge difference in performance compared with what we see in WinForms applications. Setting this background to a solid color improves performance a lot, and I believe that in this case we see results similar to what we get in WinForms.
FlexGrid for WinForms doesn't support ICollectionView, so for testing purposes we created System.Data.DataTable from the same data we used in all WPF tests. And we use DataTable.DefaultView as DataSource for WinForms FlexGrid. Also, we had to make different implementation for all tests. You can check details in attached source code.
WPF and WinForms platforms are very different and probably WindowsFormsHost adds some overhead. So there's no sense in counting an absolute time difference for complicated scenarios like rendering complex UI control. But you can play with all grids at run time and get overall impression of how they're comparable. Full test results are attached, so you can also look at numbers.
This time we didn't include any competitors. Instead we checked our progress comparing with 2016 v2 release. In the figures below, you can see that we got some improvement in initial loading and grid creation both for C1DataGrid and FlexGrid controls. We also improved C1DataGrid performance at loading data. Other tests don't show significant difference.
The benchmarks were run on HP ENVY-23 All-in-One Desktop with next parameters:
Intel i7 quad-core CPU @ 3.10 GHz
8 GB RAM
NVIDIA GeForce GT 630M display adapter, Full HD (1920 x 1080) resolution
Windows 10 Pro 64-bit OS Version 10.0.14393 Build 14393
All grids were set to equal size, and default appearance. All tests (both with 2017 v1 and 2016 v2 releases) were performed with the same version of test application in the same environment.