diff options
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), ], ); } |
