Skip to content
Back to the work
Public repo

lattice

A spreadsheet-grade data grid for a million rows.

TypeScriptViteWeb WorkerPlaywright

Problem

Browser data grids fall over well before a million rows. The DOM cannot hold that many nodes at once, and a naive spreadsheet recalculates every formula on each edit, so typing in a single cell stalls the whole sheet.

Approach

lattice keeps a fixed pool of roughly 560 row elements and recycles them as the viewport moves, so DOM size stays flat no matter how far the user scrolls. Formulas live in a dependency graph on a Web Worker, which means an edit walks only the cells that actually depend on it.

Outcome

A million rows scroll inside a steady frame budget, and an incremental recalc touches 33 of 10,000 nodes instead of all of them. Recalc time fell from 316ms to 1.0ms with repaints at 3.4ms, measured on a deliberately low-end machine with no GPU acceleration.