diff options
| author | tv <tv@krebsco.de> | 2026-11-03 06:53:42 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-03 06:53:42 +0100 |
| commit | 389b758df8990c53a132af9b3d7de5b6714be2ab (patch) | |
| tree | 18e82857c946030c55a607830d558f5b7781842f /src/remake | |
| parent | af0b36a1532311669303dc8134bf74e2d607ef0c (diff) | |
fixup 700, 701, 702
Diffstat (limited to 'src/remake')
| -rw-r--r-- | src/remake/bench.rs | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/src/remake/bench.rs b/src/remake/bench.rs index f262601..fa9f358 100644 --- a/src/remake/bench.rs +++ b/src/remake/bench.rs @@ -8,40 +8,9 @@ use std::time::Instant; -use automerge::transaction::Transactable; -use automerge::{ObjType, ROOT, ReadDoc, ScalarValue}; - use super::delta::{Superseded, replay_newest}; use super::kind::Translator; -use crate::document::Document; -use crate::document::bench::{document, median}; -use crate::document::store; - -/// `count` changes to `doc`, each writing one key under `data` (from `first` on), made -/// at `at` and after. -fn writes(doc: &mut Document, first: usize, count: usize, at: i64) { - for i in 0..count { - let mut transaction = doc.transaction(); - let data = transaction - .get(ROOT, "data") - .expect("read") - .map(|(_, id)| id) - .unwrap_or_else(|| { - transaction - .put_object(ROOT, "data", ObjType::Map) - .expect("map") - }); - transaction - .put( - &data, - format!("late{}", first + i), - ScalarValue::Int(i as i64), - ) - .expect("write"); - transaction - .commit_with(automerge::transaction::CommitOptions::default().with_time(at + i as i64)); - } -} +use crate::document::bench::{document, median, snapshot, writes}; /// `late` writes made to the old document after `keys` keys, carried into a new one /// holding those keys (as a snapshot, at time 0) and `newer` writes of its own made @@ -53,12 +22,7 @@ fn replay(keys: usize, late: usize, newer: usize) { writes(&mut old, 0, late, 1_000); let after = old.get_heads(); - let mut new = Document::new(); - { - let mut transaction = new.transaction(); - store::materialize_into(&old_base, &mut transaction, &|_| false).expect("snapshot"); - transaction.commit_with(automerge::transaction::CommitOptions::default().with_time(0)); - } + let mut new = snapshot(&old_base); writes(&mut new, late, newer, 2_000); let took = median(5, || { |
