automerge / automerge-classic

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
http://automerge.org/
MIT License
14.75k stars 466 forks source link

Add fast path to OpSet.getMissingChanges #340

Closed ept closed 3 years ago

ept commented 3 years ago

Improves performance in the common case where user wants to just get the most recent couple of changes, e.g. in the context of a frequent sync. In this case, the cost becomes linear in the number of changes returned, whereas previously it was linear in the size of the entire change history.

In this benchmark, the case of 1,000 changes and syncing after each change speeds up by roughly 10x after applying this patch.