Performance
Recalculate 100,000 formulas, live
Change one cell that 100,000 formulas read, or move 1,000 lookups. The page times each recalculation and paint in your browser.
- Rows
- 100,000
- Formulas
- 101,002
- Load and first calculation
- …
Try it
What the timings include
- Last recalculation runs from the edit call until a dependent total is readable: the engine marks the formulas that read the cell and calculates each once.
- Frame painted adds the next frame the browser draws. Your device, browser and other tabs change every number on this page.
- The release benchmarks measure the same work on fixed machines; see formula engine performance for their results.
The page times each edit in two parts: the engine's recalculation, then the grid's paint.
The code behind it
import "@sheetwrite/core/styles.css";
// A "model" sheet of 100,000 rows. Each block holds 5,000 rows of SKU, price and// units, each with a revenue formula such as =B1*C1*(1+$G$1) that reads the// price-change cell G1.
// The grid fills its host, so the host needs a heightconst host = document.querySelector<HTMLElement>("#grid");if (host === null) throw new Error("Missing #grid host");host.style.height = "480px";
// The grid mounts empty; the rows follow in blocks with a yield between them,// so the page paints and takes input while 100,000 formulas load. Loading goes// through applyRemoteOperations so it is not an undo step.for (let start = 0; start < 100_000; start += 5_000) { await new Promise((resolve) => setTimeout(resolve, 0)); { }, ]);}
// One edit, timed until a dependent total is readable, then until the next frameconst started = performance.now();});const recalcMs = performance.now() - started;requestAnimationFrame(() => requestAnimationFrame(() => console.info({ recalcMs, paintedMs: performance.now() - started })),);
// When the page removes the host: grid.destroy();