diff options
| author | tv <tv@krebsco.de> | 2026-11-07 22:35:21 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-07 22:35:21 +0100 |
| commit | cc691bade836d27d02bb2330f0fa323a1d88a1bb (patch) | |
| tree | 951be3a00aac0b945e73a365ddff322e85193934 /src/document/bench.rs | |
| parent | 2aa2fb8c757c9595084960804a128ea701b17356 (diff) | |
inspect: the paths changes touch
document::inspect: each change's paths read from its operations before
it is applied, the same on every node: an object's place as made, cut
at lists and text; unknown objects at the root.
Auth plan M6.
Diffstat (limited to 'src/document/bench.rs')
| -rw-r--r-- | src/document/bench.rs | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/document/bench.rs b/src/document/bench.rs index 1bb13ee..bc1f6fa 100644 --- a/src/document/bench.rs +++ b/src/document/bench.rs @@ -25,7 +25,10 @@ //! the change left it (`store::changed_by`, so every node finds the same paths). Against //! receiving a sync message of many changes and loading a document of many changes, as //! above, each change writing a value three levels deep; and decoding alone, the part -//! that grows with the change rather than with its objects. +//! that grows with the change rather than with its objects. Decoded as the document +//! rebuilds them, and from the bytes they came as; and inspected before they are +//! applied (`inspect::Inspector`), their objects made among them or looked up in the +//! document, each once. use std::time::{Duration, Instant}; @@ -509,6 +512,36 @@ fn path_costs(workload: &str, base: Duration, doc: &Document) { } started.elapsed() }); + // Before they are applied (`inspect::Inspector`): those of a sync message to a node + // that has none of them, their objects made among them; those of a document loaded, + // looked up in it. + let inspected = median(3, || { + let empty = Document::new(); + let started = Instant::now(); + let changes: Vec<automerge::ExpandedChange> = raw + .iter() + .map(|(_, bytes)| { + automerge::Change::from_bytes(bytes.clone()) + .expect("change") + .decode() + }) + .collect(); + std::hint::black_box(super::inspect::Inspector::new(&empty).paths(&changes)); + started.elapsed() + }); + let looked_up = median(3, || { + let started = Instant::now(); + let changes: Vec<automerge::ExpandedChange> = raw + .iter() + .map(|(_, bytes)| { + automerge::Change::from_bytes(bytes.clone()) + .expect("change") + .decode() + }) + .collect(); + std::hint::black_box(super::inspect::Inspector::new(doc).paths(&changes)); + started.elapsed() + }); report_signatures( workload, base, @@ -517,6 +550,8 @@ fn path_costs(workload: &str, base: Duration, doc: &Document) { ("paths", paths), ("from bytes: decoding", decode_bytes), ("paths", paths_bytes), + ("inspected, made among them", inspected), + ("looked up", looked_up), ], ); } |
