diff options
| author | tv <tv@krebsco.de> | 2026-11-02 11:20:30 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-02 11:20:30 +0100 |
| commit | 315c0261ca1cfaf13cf4fde53642edc2bc63a73b (patch) | |
| tree | 10ce0ebfccd2a61c3f3c65df532589339538015e | |
| parent | 99b10401ea70a016c7f3e23dbcd1149e6d56e008 (diff) | |
remake: read ops, not diffs
This gives bench_replay a speedup of ~8x/64x/280x.
| -rw-r--r-- | src/remake/bench.rs | 3 | ||||
| -rw-r--r-- | src/remake/delta.rs | 9 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/remake/bench.rs b/src/remake/bench.rs index 3c3f513..f262601 100644 --- a/src/remake/bench.rs +++ b/src/remake/bench.rs @@ -3,7 +3,8 @@ //! `replay`: carrying writes over into a new epoch's document, last writer wins //! (`delta::replay_newest`): what a rejoin does with the writes made during it, and a //! switch with those made after the remake's base. It finds the paths of every write -//! carried, and of every newer change in the new document, by a diff each. +//! carried, and of every newer change in the new document, from its operations +//! (`store::changed_by`). use std::time::Instant; diff --git a/src/remake/delta.rs b/src/remake/delta.rs index 2c6c93d..638231c 100644 --- a/src/remake/delta.rs +++ b/src/remake/delta.rs @@ -163,16 +163,15 @@ fn between(doc: &Document, before: &[ChangeHash], after: &[ChangeHash]) -> Vec<C found.into_iter().collect() } -/// For each of `changes` (in `doc`), its time and the store paths it touched. +/// For each of `changes` (in `doc`), its time and the store paths it touched, from its +/// operations (`store::changed_by`: a diff per change would cost what the maps it +/// touched hold, `remake::bench`). fn touched(doc: &Document, changes: &[ChangeHash]) -> Vec<(i64, Vec<Vec<String>>)> { changes .iter() .filter_map(|hash| { let change = doc.get_change_by_hash(hash)?; - let paths = store::changed(doc, change.deps(), &[*hash], InLists::Whole) - .into_iter() - .map(|changed| changed.path) - .collect(); + let paths = store::changed_by(doc, hash, InLists::Whole)?; Some((change.timestamp(), paths)) }) .collect() |
