perf(lib): speed up commits via Loro fork + incremental sign - #1250
Draft
joepio wants to merge 5 commits into
Draft
perf(lib): speed up commits via Loro fork + incremental sign#1250joepio wants to merge 5 commits into
joepio wants to merge 5 commits into
Conversation
joepio
force-pushed
the
cursor/commit-performance-a52a
branch
from
August 3, 2026 09:10
b00aec1 to
6b8bffb
Compare
cursor
Bot
force-pushed
the
cursor/commit-performance-a52a
branch
from
August 3, 2026 09:55
6b8bffb to
d527c9b
Compare
joepio
force-pushed
the
cursor/commit-performance-a52a
branch
from
August 4, 2026 08:02
d527c9b to
52cf542
Compare
Resource::clone and build_state_doc no longer serialize/deserialize a full Loro snapshot; they fork in-memory. apply_changes drops its internal resource_old clone (caller keeps one copy). sign_at exports export_updates_since(persisted_vv) for follow-up edits instead of a full snapshot, cutting per-commit payload and history growth. Adds commit_bench and a regression test that follow-up loroUpdates stay incremental. See planning/commit-performance.md. Co-authored-by: Joep Meindertsma <joep@ontola.io>
Co-authored-by: Joep Meindertsma <joep@ontola.io>
…ache Bootstrap dominates cold init_temp (~120ms release). Cache a process-local bootstrapped atomic.redb and fs::copy it for each subsequent call (~10ms). Also route file opens through redb Builder with a 64 MiB cache (16 MiB for temp DBs) instead of the unused 1 GiB default the comments already intended. Co-authored-by: Joep Meindertsma <joep@ontola.io>
Co-authored-by: Joep Meindertsma <joep@ontola.io>
The new helper was missing the not(wasm32) cfg that new_file_with_cache already has, so wasm-pack failed with E0599 in CI. Co-authored-by: Joep Meindertsma <joep@ontola.io>
joepio
force-pushed
the
cursor/commit-performance-a52a
branch
from
August 5, 2026 07:56
52cf542 to
6e5cae7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Speeds up the commit hot path and
Db::init_temp(the setup tax every test/bench pays).Bottlenecks
Commit path
Resource::clone/build_state_docdidexport_snapshot()+from_snapshot()(paid multiple times per commit)apply_changesdouble-clonedresource_oldsign_atalways exported a full snapshot asloroUpdatedespite its docstringDb::init_temp(related only as shared test overhead)RedbStore::new_fileused redb’s 1 GiB default cache despite comments saying Builder would drop itFixes
AtomicLoroDoc::fork()for in-process clones / working docssign_atexportsexport_updates_since(persisted_vv)for follow-ups (genesis still full snapshot)init_tempcopies a process-local bootstrappedatomic.redbtemplate after the first callBefore / after (release, same machine; before =
develop@ 7863501)Db::init_temp(warm / Nth call in a process)edit_save_locally(10 prior edits)loroUpdatesize (20-edit history)Resource::clone(50-edit doc)Clone wall-clock is flat at this doc size (Loro
forkis also O(n)); the clear wins are incremental payloads, fewer apply clones, andinit_temp.See
planning/commit-performance.md.Related Issues
N/A — performance investigation.
Checklist
planning/commit-performance.md)