Where size hurts
A long collaborative document strains memory and CPU because every character may carry metadata like ids and tombstones, and the operation history grows without bound. Naive rendering and merging then slow to a crawl.
Key techniques
- Block compression stores runs of consecutive characters under one id range instead of one record each.
- Garbage collection of tombstones removes deleted markers once all replicas have seen them.
- Snapshotting periodically collapses history so new clients do not replay millions of operations.
Rendering and loading
Large documents use virtualized rendering so only the visible portion is laid out, and lazy loading of sections so opening the file does not deserialize everything at once.
Tombstone collection is delicate, since removing a marker before a slow replica has seen it can break convergence, so it waits for a safe causal threshold.
Key idea
Large collaborative documents stay fast through block compression, safe tombstone collection, snapshots, and virtualized lazy rendering.