Introduction
deltamesh answers one question: given two large structured documents, what is the smallest set of operations that turns the first into the second — and can we compute it without loading either into memory?
When you want this
- Replicating a dataset across a slow or metered link, where sending the full snapshot each cycle is wasteful.
- Building an audit trail of changes to configuration or catalogue data.
- Feeding a change-data-capture pipeline from systems that only expose full exports.
- Detecting drift between a declared desired state and the observed one.
When you do not
If your documents comfortably fit in memory and you already emit change events at the source, a plain JSON Patch library will be simpler and faster. deltamesh earns its complexity from about 50 MB per document upwards.
Model
Internally every input is projected onto the same tree: ordered sequences, unordered maps with comparable keys, and opaque leaves. The differ walks both trees in lockstep, emitting operations as soon as a subtree is known to differ — which is what keeps memory flat.
// the four operation kinds type Op struct { Kind OpKind // Insert | Delete | Replace | Move Path Path // location in the target tree Value Value // nil for Delete }
Guarantees
| Property | Holds | Notes |
|---|---|---|
| Determinism | Yes | Same inputs produce byte-identical patches |
| Minimality | Per subtree | Globally minimal edit scripts are NP-hard for unordered trees |
| Reversibility | Yes | Unless WithCompactDeletes is enabled |
| Streaming | Yes | Both differ and applier |
Next
Head to the quickstart for a working example in about ten lines.