DataGrid - Performance and virtualization

Performance & virtualization

The <ReactDataGrid /> is designed from the ground-up to be very fast and efficient with big datasets. If you can fit a dataset into the browser without making it freeze, then handling it through the <ReactDataGrid /> will be by no means worse.
Besides being able to render huge amounts of data (and therefore very many rows), the grid is also built to support a big number of columns. Although in most cases 10 columns or less are enough, the <ReactDataGrid /> can handle about 50 columns quite easily.
In order to make the component fast while handling and displaying so much data, virtualization has been used extensively. Virtualization is used for both the rows and for the columns (in case there are many columns).
Virtualizing the rows is possible because of the fixed row height (configured via rowHeight - defaults to 40). Column virtualization is performed when the number of columns is greater or equal to virtualizeColumnsThreshold (defaults to 15) or when virtualizeColumns=true.
<ReactDataGrid /> peformance mostly refers to how the <ReactDataGrid /> behaves & updates while scrolling - since this is the most performance-sensitive operation one can do with a <ReactDataGrid />.
In case you run into a performance issue, the first thing you need to check is whether you're updating <ReactDataGrid /> props unnecessarily.
To boost performance of the <ReactDataGrid />, we treat props as immutable and only update the <ReactDataGrid /> when you pass different props.
So for example, to improve the rendering performance, make sure you pass the same reference to a dataSource when rendering the <ReactDataGrid />, instead of building the dataSource in the render function of your app and passing it new each time to the<ReactDataGrid />, even when the dataSource doesn't change.
If the performance issue still persists, you might try to increase the default rowHeight. The less rows fit into the viewpot, the snappier the <ReactDataGrid /> is.
In case you have many columns, and the <ReactDataGrid /> performs column virtualization, try increasing the widths of <ReactDataGrid /> columns in order to improve performance. The less columns fit into the viewport, the snappier the <ReactDataGrid /> is.

Flexible or natural row height

The <ReactDataGrid /> is built with row virtualization in mind. If however you need rows that have their natural height (different rows with different heights), you need to configure the <ReactDataGrid /> with rowHeight=null. In this case, you also need to help the <ReactDataGrid /> by specifying a minimum height for the rows, via minRowHeight - this will help the <ReactDataGrid /> in virtualizing the rows by specifying that all rows will at least have the specified minimum height.
For specifying different fixed row heights for certain rows, please use rowHeights
When using rowHeight=null you might run into some edge cases or props that are not well supported - it definitely won't perform as well as configurations with fixed rowHeight. So be warned that <ReactDataGrid /> components with rowHeight=null might be quite rough around the edges (except if you're disabling virtualization - see the note below).
In case you have small datasets and want to avoid virtualization, you can configure the grid with virtualized=false.
When turning off virtualization via virtualized=false it's safe to use rowHeight=null to render <ReactDataGrid /> components with flexible/natural row heights.
Top