Skip to content

Performance Guide

Follow these patterns to preserve NextGrid’s O(viewport) rendering and avoid unnecessary work on the main thread:

  1. Always provide stable row identity (getRowId / rowKey): Enables incremental transactions (applyRowTransaction), avoids re-creating selection state, and prevents stale edit races.
  2. Memoize columnDefs: In React, Vue, Svelte, and Angular, pass stable ColumnDef object references (useMemo, computed, $derived, class fields) so setColumnDefs does not re-run client sorting/filtering or recreate renderers on every render.
  3. Prefer applyRowTransaction over setRowData: Replacing rowData bumps dataEpoch, clears undo history, and recreates cell renderers; transactions update only affected rows.
  4. Batch high-frequency updates with applyRowTransactionAsync: Coalesces bursts into one animation-frame commit.
  5. Implement update(params) returning true in cellRenderer: Cells scroll through recycled DOM pools; returning true updates text/styles in place instead of destroying and recreating elements every scroll frame.
  6. Keep formatter, valueGetter, and isMaster cheap and pure: These run across visible/sampled cells and during sorting/filtering.
  7. Use RowSource or Remote/Viewport Models for 100k+ rows: Avoid materializing huge client arrays when lazy indexing (rowSource) or block-cached server pagination (infinite / serverSide) fits better.