heddle

Comparison · version 0.8.0

Heddle and the alternatives

What else does this job, what each is best at, and one workload measured on all of them.

Take this page with a grain of salt.

Heddle is a new library and this page is still being written. The feature notes were read from each project's documentation in November 2026 and may be out of date or unfair to a project we know less well. The numbers are one small workload on one machine. Where Heddle loses, this page says so, and it loses on speed and on size.

The short answer

Pick Heddle

For versions a person steps through: undo that survives a reload, branches, restoring one part of an old version, a history panel, a format you can read. One commit per decision.

Pick a CRDT

For several people typing into the same thing at once. Yjs for live text and speed. Automerge when the full history of a shared document matters too.

Pick less

For undo within one session, an undo stack or Immer's patches are smaller and faster than any of these.

The alternatives

Automerge

A CRDT document with its whole change history, in a compact binary format, with a Rust core compiled to WebAssembly.

Best when: Several people edit the same document at once, offline included, and merges must happen by themselves.

Against Heddle: Automerge merges concurrent edits itself and stores history far more compactly. Heddle reports a conflict and lets the app choose, keeps plain JSON anyone can read, and adds undo, a scrubber and partial restore. Heddle ships about a hundredth of the code.

Yjs

A CRDT of shared types (maps, arrays, text) built for live co-editing, with editor bindings, network providers and an awareness protocol for presence.

Best when: Live co-editing, text above all: it is the fastest and best connected option for that.

Against Heddle: Yjs is hundreds of times faster per edit and syncs in tiny updates. By default it does not keep old versions, and its undo is a session stack. Heddle keeps every version, on disk, with ids, branches and a way to check them.

Immer with patches

Immutable updates written as mutations, which can emit a patch and an inverse patch per change.

Best when: You want undo and redo in one session and are happy to keep the patch log yourself.

Against Heddle: Immer is smaller and much faster, and it is not a history: no ids, no file format, no branches, no merge. Heddle is what you would otherwise build on top of the patches.

An undo stack

Past, present and future kept as snapshots or commands in memory: redux-undo, zundo, or a few lines of your own.

Best when: Undo and redo that end with the session are all you need.

Against Heddle: Nothing is simpler. Heddle's linear model has the same shape for the user, and adds saving with the undo position, shared storage of unchanged parts, and an upgrade to branches without a migration.

Git itself

A real repository beside the app, through the git binary or isomorphic-git, with the document as files.

Best when: The document already is files, and people want to use git tools on it.

Against Heddle: Git has every history feature and a vast toolchain. It versions bytes in files: a merge is line-based, and the app must map its state to a tree. Heddle versions the JSON state directly, merges by key, and runs in a page with no file system.

A time-series store

A database made for samples by time, on a server or embedded.

Best when: Ticks have to be kept for good, queried across devices, or number in the millions.

Against Heddle: Heddle's stream is a capped buffer in memory with time lookups, candles and chunks. It is for the ticks an app needs while it runs, such as cursors and a chart's recent window, and it is not a database.

Features, side by side

Features of Heddle and four alternatives
HeddleAutomergeYjsImmer with patchesAn undo stack
You hand itThe whole state, as JSONChanges to a documentChanges to shared typesA function that mutates a draftA state or a command
Old versions keptEvery commitEvery changeNot by defaultIf you keep the patchesIn memory, often capped
Undo and redoBuilt in, saved with the documentYou build itUndoManager, for the sessionYou apply inverse patchesYes, that is all it does
BranchesGraph modelFork and mergeNoNoNo
MergeBy key, 3-wayAutomaticAutomaticNoNo
Two edits to one valueA conflict the app settles, or a ruleOne wins, the other is kept as a conflict valueOne winsNot handledNot handled
Restore one part of an old versionrestore(from, part)You copy itNoNoNo
Check the historyverify(): hashes and op logsChanges are hashedNoNoNo
Live co-editing of textNoYesYes, its main useNoNo
Presence and other ticksheddle/streamEphemeral messages in its sync layerAwareness protocolNoNo
Saved formatJSON, readable, hash-namedCompact binaryCompact binaryYoursYours
History UImountHistory: timeline, graph, restoreNoNoNoNo
Runtime dependenciesNoneA WebAssembly moduleA few small onesNoneVaries

Read from each project's documentation in November 2026. Not tested by this repository. Corrections are welcome.

One workload, measured

1,000 items, then 200 edits of one item each, every edit a version. bun run compare builds the same document in each library, applies the same seeded edits one at a time, then undoes 50 of them, saves the document with its history, loads it back, and measures what a peer missing the last edit would be sent. Each library is used the way its documentation shows for keeping history. Code shipped is the library's entry bundled for a browser, minified and gzipped, with any WebAssembly module included.

One workload, five ways
LibraryEdit, medianUndo, medianSaved with historyLoadOne edit to a peerCode shipped
Heddle, grouped state
Version history of a JSON state
1.8 ms0.146 ms1.5 MB11.6 ms6.3 kB11.3 kB
Heddle, flat state
Version history of a JSON state
1.8 ms0.337 ms16.5 MB111 ms81.2 kB11.3 kB
Automerge
CRDT document with its full change history · 3.5
0.210 msnot offered19.1 kB14.5 ms0.1 kB1.2 MB
Yjs
CRDT document for live co-editing · 13.6
0.007 ms0.007 ms74.6 kB4.9 ms0.6 kB29.3 kB
Immer with patches
Immutable updates that emit patches · 11.2
0.072 ms0.069 ms74.8 kB0.262 ms0.1 kB7.7 kB

Measured 2026-11-12 on Bun 1.4, darwin arm64. Bars are on a log scale within each column: shorter is better. One state is 45.6 kB of JSON, and 201 full snapshots of it would be 9.2 MB.

How to read it

  1. Heddle is the slowest per edit. A commit hashes the whole state to find what changed. Automerge and Yjs are told what changed. On a 1,000-item state that is about two milliseconds against a fraction of one. It is fine for a commit per gesture and wrong for a commit per keystroke.
  2. Heddle's saved history is the largest. It is JSON text with a 64-character id per node, and each commit rewrites the path it touched. The binary formats are ten to a hundred times smaller. Grouping the state closes much of the gap with a snapshot copy, and none of the gap with the CRDTs.
  3. Heddle ships the least code that does the most history. About 11 kB for commits, branches, merge, restore, verify and saving. Immer is smaller and does none of those. Automerge is about a megabyte with its WebAssembly module.
  4. They are not the same job. Yjs's number is for a document that forgets old values. Immer's is for a log the app must manage. Only Automerge and Heddle keep every version here, and only Heddle surfaces conflicts instead of resolving them.

Run it yourself: bun run compare [items] [edits] writes reports/compare/results.json, and the next site build prints it here. Heddle's own numbers over time are in the test lab.

What this page does not cover yet