Systems & toolingAutomatic version history, thinned with age
A copy of a document kept by itself a few minutes into each stretch of changes, and named copies on demand; thinned as they age (every copy for two hours…
What it costs a frame
- GPU
- not used
- CPU, median
- 0.05 ms
- CPU, 95th pct
- 0.09 ms
- Draw calls
- 0
- Weight
- Light
Measured 4 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 156, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Measured with the clock at an hour a second and the simulated author writing: each frame moves the clock, keeps any copy due (one IndexedDB transaction, thinned in it), thins in memory as copies age and moves the timeline’s dots; the list redraws four times a second. Phones: tiers are being measured next.
| Machine | GPU ms | CPU ms | CPU p95 |
|---|---|---|---|
| unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool | not timed | 0.05 | 0.09 |
| apple · Apple A19 Proin a browser tab · 16 November 2026 | not timed | 0.06 | 0.08 |
| Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026 | not timed | 0.08 | 0.16 |
Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.
What it needs
- Renders with
- DOM and CSSPlain DOM and CSS: every current browser.
- Your browser
- Runs hereNo WebGPU needed
- Depends on
- NothingNo other packages
What it’s for
- Editors and note apps
- Boards and canvases
- Design and level tools
- Long forms and drafts
- Anything saved only in the browser
- A library of documents with a Trash
- Moving off localStorage
- Game saves and app state that must never strand the player
- Settings or documents whose format changes between versions
Pitfalls, in brief
- Thin after every copy kept and when time passes: copies age into a coarser tier without anything being written, and thinNow(doc) is what lets them go.
- Name what must never go: thinning only ever looks at unnamed copies, so a “Before the redesign” copy stays until someone deletes it.
- Keep copies on this device apart from the document people sync: in the shared document every collaborator would download every copy.
- Days are cut in UTC unless you pass offset: “one a day” then means one per UTC day, which may not be the reader’s day.
- A storage error is a result, not an exception: check ok and tell the person (once) when the disk is full or the window is private, or they will trust a history that is not there.
12 more in brief
- Keep a copy of what is there before restoring: a restore is then itself undone from the same list.
- IndexedDB is per origin and per browser: it is not a backup.
- Moving off localStorage, never delete the old key: check the whole old list first (one damaged entry stops the move, and the next load tries again), copy it in one transaction, and mark the move done in that same transaction so it runs once.
- A save must refuse a document in Trash, inside the transaction that would write it: otherwise a stale tab’s autosave, or a debounced save already queued, quietly brings back what the person just threw away.
- Trash the open document with its latest edits (trash(id, current)) and cancel any queued save first: the edits are kept in the same step, and the recovery copy goes with it, so a reload does not reopen it.
- Wait for the transaction’s complete event, not the request’s success: a full disk arrives as an abort after every request has succeeded, so only complete says the write is kept.
- The limit counts Trash too: offer “Delete for good” (erase) or a full library stays full.
- Keep the last good save beside the newest, in the same row, written whole: two rows (or two files) can be left half-updated by a crash, and then neither is the one before.
- Move the newest save to “the one before” only once it is a while older than the one already there (a minute by default): saving every ten seconds would otherwise fill both slots with the same moment, and the fallback would fall back to the same bad state.
- Read a damaged save as missing, never as an error, and say so once in plain words.
- Never write over a save made by a newer version of the app: an older tab or an older install that cannot read it would replace it with less.
- Tell “could not be read” (the storage or network failed) apart from “there is none”: start fresh without saving, or the first autosave writes over a good save that was only out of reach.
Where it comes from
From SpaciousPro. Fully custom code.
Grandfather–father–son rotation: the backup scheme of keeping fewer copies the older they get, which the tiers follow (an idea, no code)
Longest common subsequence diff: the textbook dynamic-programming line diff behind diffLines (as in Hunt and McIlroy’s diff, much simplified)


