Million

SRJT-001

A spreadsheet engine for the browser, written from scratch.

Status
Active
Package
Browser, web worker
Live
million.srijit.me

1,000,000-row spreadsheet engine with live formulas

Features

  • Holds 1,000,001 rows with 4,000,009 live formulas
  • Only the cells that depend on an edit recalculate
  • A filled-down column compiles once, to one JavaScript function
  • Dependents found by arithmetic, not by per-cell edge lists
  • Totals keep themselves: cached SUM and AVERAGE, group indexes for SUMIF, hash indexes for XLOOKUP
  • Recalculates in 8 ms slices on a web worker; the grid keeps scrolling
  • Canvas grid reads engine memory through a SharedArrayBuffer
  • Runs on your machine: no server, no account, no upload
  • 56 tests, with differential tests against a full recalculation

Pin configuration and functions

1PARSE2SHEET3CACHE4CSV5PILOT6GRID7DEMO8WORK

N package, 8-pin, top view

PinNameI/ODescription
1PARSEIFormula parser, printer and reference shifting for paste engine/parser.ts
2SHEETI/OColumns, compiler, reverse index and sliced recalculation engine/sheet.ts
3CACHEI/ORange caches, group indexes and lookup indexes engine/caches.ts
4CSVIStreaming CSV parser engine/csv.ts
5PILOTIScripted cursor that drives the landing page components/autopilot.ts
6GRIDOCanvas grid, editor, selection, clipboard and shortcuts components/Grid.tsx
7DEMOIThe million-order demo ledger engine/demo.ts
8WORKI/OWeb worker: edits, undo, paste, CSV import, benchmark engine/worker.ts

Electrical characteristics

Chrome 156, production build, M5 MacBook Air, demo ledger. Small edits are timed as a batch of 50 and divided. Each result is the median of 7 rounds.

ParameterTest conditionsMinTypMaxUnit
Capacity
Rows, demo ledger1,000,000 orders, 8 columns1,000,000 orders, 8 columns–1,000,0011,000,001–rows
Live formulasWhole ledger, with the summary panelWhole ledger, with the summary panel–4,000,0094,000,009–formulas
Compiled functionsOne per filled-down columnOne per filled-down column–1111–fn
Engine memoryTyped-array columnsTyped-array columns–129129–MB
Built-in functionsFunctions in the formula languageFunctions in the formula language–3333–fn
Recalculation
tLOADBuild and calculate4,000,009 cells4,000,009 cells–0.250.25(1)–s
tEDITSmall editUnits of one order; 12 cellsUnits of one order; 12 cells–33–µs
tMOVEGroup moveRegion of one order; 4 cells, between SUMIF totalsRegion of one order; 4 cells, between SUMIF totals1–1 to 33µs
tCHAINChain editUnits of the first order; 1,000,011 cellsUnits of the first order; 1,000,011 cells66–66 to 6969ms
tRATEBroadcast editTax rate that every row reads; 3,000,008 cellsTax rate that every row reads; 3,000,008 cells–185185–ms
tSLICERecalculation sliceWeb worker, between grid framesWeb worker, between grid frames–88–ms
Input and display
tCSVOpen a CSV56.5 MB, 1,000,000 rows, drop to sheet56.5 MB, 1,000,000 rows, drop to sheet–0.550.55(1)–s
Scroll throughputScrollbar drag, top to bottom, 60 fpsScrollbar drag, top to bottom, 60 fps–24,40024,400(1)–rows/frame
Grid draw timeCanvas grid, per frameCanvas grid, per frame–11(1)–ms

(1) The source states this value as “about”. Every number on this page is from the project README. Run bun run bench to measure your own machine.

Typical performance characteristics

Figure 2. Edit recalculation time vs. cells recomputed
110010k1M10M100 ns1 µs10 µs100 µs1 ms10 ms100 ms1 sCells recomputed →↑ TimeRegion change, 4 cellsUnits change, 12 cellsRunning total, 1M cellsTax rate, 3M cells110010k1M10M100 ns1 µs10 µs100 µs1 ms10 ms100 ms1 sCells recomputed →↑ TimeRegion change, 4 cellsUnits change, 12 cellsRunning total, 1M cellsTax rate, 3M cells

Chrome 156, production build, M5 MacBook Air. The 1,000,000-order demo ledger.

Figure 3. HyperFormula 3.5.0 as a multiple of Million
1×10×100×1k×10k×100k×1M×Million · HyperFormulaBuild and calculate0.2 s · 84.6 s423×Peak memory187 MB · about 7.4 GBabout 40×Change the units of one order0.005 ms · 2,062 ms412,400×Change the tax rate147 ms · 12,006 ms82×HyperFormula ÷ Million →1×10×100×1k×10k×100k×1M×Million · HyperFormulaBuild and calculate0.2 s · 84.6 s423×Peak memory187 MB · about 7.4 GBabout 40×Change the units of one order0.005 ms · 2,062 ms412,400×Change the tax rate147 ms · 12,006 ms82×HyperFormula ÷ Million →

Bun 1.4.4, same machine, the same 1,000,000-order ledger. Both engines gave the same values.

HyperFormula does much more than Million: hundreds of functions, named ranges and linked sheets. This shows what a narrow engine can do; it does not say HyperFormula is slow at its own job.

Application circuit

U1MILLION ENGINEFormula compilerReverse indexRange and group cachesU2CANVAS GRIDAbout 1 msa frameJ1CSV INCSVEDITSABCLK8 ms SLICESharedArrayBufferread in placeEDIT · UNDO · PASTEDS1J1CSV INCSVU1MILLION ENGINEFormula compilerReverse index8 ms slices on a workerSharedArrayBufferU2CANVAS GRIDAbout 1 ms a frameDS1DISPLAYEDIT · UNDO · PASTE

Figure 4. SRJT-001 Typical Application: CSV in, live grid out

Ordering information

Orderable partSRJT-001 MILLION
StatusActive
PackageBrowser, web worker
Livemillion.srijit.me
Sourcegithub.com/DevSrijit/million
LicenseMIT
BuildNext.js 16, React 19, TypeScript. The engine and the grid use no libraries.