Skip to content

How we measured performance ​

The numbers in Sorting and filtering were measured with the method below. The same script is included below, so you can run it on your own machine.

What is measured ​

We put 100,000 rows into createGridCore (the core that handles data without any screen), change the sort or filter, and time it up to reading the visible row count. Sorting and filtering are computed at the moment you read, so the read must be inside the timing to get the real cost. Drawing and scrolling are not measured. The screen draws only the visible rows, so the drawing cost does not grow with 100,000 rows.

Data ​

  • 100,000 rows with the columns id, name, dept, price and at (a date).
  • Values come from a fixed-seed pseudo-random generator instead of Math.random, so everyone gets the same data.
  • name is four Korean syllables plus the row number, so all 100,000 values differ. dept is two Korean syllables with 196 distinct values. price is an integer from 0 to 1,000,000 and at is a date within about three years.

Steps ​

  1. Generate the data and create the core once with createGridCore (this time is not measured).
  2. Start every task with sorting and filtering cleared.
  3. Run one warm-up and throw it away, so JIT compilation and first-time work do not leak into the numbers.
  4. Run the same task 7 times and time each with performance.now(). Each run flips the sort direction or changes the filter value a little, so a cached result cannot be reused.
  5. Sort the 7 times and use the median (the fourth value). It is steadier than the mean when one or two runs jump.

There are five tasks: sort by one number column, sort by a Korean text column (196 distinct values), a number between filter, sort by a Korean text column (100,000 distinct values), and add one row while sorted and recompute.

Machine ​

The numbers in the guide were measured with the 1.3.2 build on an Intel Core Ultra 5 250K Plus (18 threads), Linux, Node 24.22 on 2026-11-13. The example output under "Run it yourself" is the result of the same script on the same machine. Results differ between machines, so compare numbers only when the same script ran on the same machine. Sorting a text column with very many distinct values depends on the speed of Intl.Collator, so the difference between operating systems and Node versions is large.

Run it yourself ​

You need Node 20 or later. Install the package in an empty folder, save the script below as bench.mjs and run it.

bash
mkdir mxg-bench && cd mxg-bench
pnpm init
pnpm add @maxgrid/core
# save the script below as bench.mjs, then
node bench.mjs

bench.mjs

js
// Run: node bench.mjs   (Node 20 or later, with @maxgrid/core installed in the same folder)
import { createGridCore } from '@maxgrid/core';

const SIZE = 100_000;
const RUNS = 7;
const SYLLABLES = '가나다라마바사아자차카타파하';

// 1) Data: a fixed-seed pseudo-random generator instead of Math.random, so everyone gets the same 100,000 rows.
let seed = 12345;
const next = () => (seed = (seed * 1664525 + 1013904223) >>> 0) / 2 ** 32;
const pick = () => SYLLABLES[Math.floor(next() * SYLLABLES.length)];
const rows = Array.from({ length: SIZE }, (_, id) => ({
  id,
  name: pick() + pick() + pick() + pick() + id, // 100,000 distinct values
  dept: pick() + pick(), // 196 distinct values
  price: Math.floor(next() * 1_000_000),
  at: new Date(2020, 0, 1 + Math.floor(next() * 1000)),
}));

const columns = [
  { id: 'id', kind: 'number' },
  { id: 'name' },
  { id: 'dept' },
  { id: 'price', kind: 'number' },
  { id: 'at', kind: 'date' },
];

// 2) Measure: discard one warm-up run, time 7 runs, use the median.
function measure(fn) {
  fn(0);
  const samples = [];
  for (let i = 1; i <= RUNS; i += 1) {
    const start = performance.now();
    fn(i);
    samples.push(performance.now() - start);
  }
  samples.sort((a, b) => a - b);
  return samples[Math.floor(RUNS / 2)];
}

// 3) Tasks: change the model, then read the visible row count. Sorting and filtering are computed when you read.
const core = createGridCore({ columns, rows, rowKey: 'id' });
const api = core.api;
const dir = (i) => (i % 2 ? 'asc' : 'desc'); // flip the direction every run so a cached result cannot be reused
const between = (i) => ({
  match: 'all',
  items: [{ columnId: 'price', operator: 'between', value: [1000 + i, 900_000] }],
});

const cases = [
  [
    'Sort by one number column',
    (i) => api.setSortModel([{ columnId: 'price', direction: dir(i) }]),
  ],
  [
    'Sort by a Korean text column (196 distinct values)',
    (i) => api.setSortModel([{ columnId: 'dept', direction: dir(i) }]),
  ],
  [
    'Number between filter',
    (i) => {
      api.setSortModel([]);
      api.setFilterModel(between(i));
    },
  ],
  [
    'Sort by a Korean text column (100,000 distinct values)',
    (i) => api.setSortModel([{ columnId: 'name', direction: dir(i) }]),
  ],
  [
    'Add one row while sorted',
    (i) => {
      api.setFilterModel(null);
      api.setSortModel([{ columnId: 'price', direction: 'asc' }]);
      api.addRows([{ id: SIZE + i, name: 'x', dept: 'x', price: i, at: new Date(2024, 0, 1) }]);
    },
  ],
];

console.log(
  `Node ${process.version}, ${process.platform}, ${SIZE.toLocaleString()} rows, 1 warm-up run + median of ${RUNS}`,
);
for (const [label, run] of cases) {
  api.setSortModel([]);
  api.setFilterModel(null);
  api.getVisibleRowCount();
  const ms = measure((i) => {
    run(i);
    api.getVisibleRowCount();
  });
  console.log(`${label}: ${ms.toFixed(1)} ms`);
}

Example output (Intel Core Ultra 5 250K Plus, Linux, Node 24, measured 2026-11-13). Your values will differ.

text
Node v24.22.2, linux, 100,000 rows, 1 warm-up run + median of 7
Sort by one number column: 23.7 ms
Sort by a Korean text column (196 distinct values): 23.6 ms
Number between filter: 2.8 ms
Sort by a Korean text column (100,000 distinct values): 140.2 ms
Add one row while sorted: 34.0 ms

Close other heavy programs while measuring, and plug in a laptop. Run it two or three times on the same machine to check that the values are close.

With virtualization off ​

The numbers were measured with the defaults (row and column virtualization on). Turning it off with virtualize: { rows: false } or { columns: false } puts everything it draws into the DOM, so first-draw and scroll time grow with the row and column count. Do not compare them with the numbers here.

Very large data (scroll compression) ​

Browsers limit the height of one scroll area (Chrome and Edge about 33.5 million px and Firefox about 17.9 million px, counted in device pixels). One million rows of 32 px is 32 million px. On a Windows display scaled to 150% a row counts as 48 px, so the limit was hit near 700,000 rows (about 560,000 in Firefox) and the end could not be reached.

Above 8 million px of content (about 250,000 rows at 32 px) the grid compresses the scrollbar. One scrollbar step moves several rows (4 times as many when the content is 32 million px), so the scrollbar thumb moves in coarser steps, but the top and the bottom always land exactly on the first and the last row, and the mouse wheel, touch, the keyboard (PageDown, Ctrl+End) and scrollToRow keep working. At or below 8 million px nothing changes. There is no option for it and nothing is shown on screen.

getScroll().top and setScroll({ top }) use the position in the full content (px), whether compressed or not. Do not read or write the browser's own scrollTop: it holds the compressed value.

Where to go next ​