aboutsummaryrefslogtreecommitdiffstats
path: root/src/document
diff options
context:
space:
mode:
Diffstat (limited to 'src/document')
-rw-r--r--src/document/bench.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/document/bench.rs b/src/document/bench.rs
index 2b82036..887ced0 100644
--- a/src/document/bench.rs
+++ b/src/document/bench.rs
@@ -680,22 +680,28 @@ fn screening_costs(workload: &str, doc: &Document) {
unjudged,
&[("screened", screened.saturating_sub(unjudged))],
);
- screening_parts(&changes());
+ let changes = changes();
+ screening_parts(&changes, 400);
+ // And with the history a document of that many has: whether a read at its heads
+ // costs more there.
+ if changes.len() > 10_000 {
+ screening_parts(&changes, changes.len() - 1_000);
+ }
}
/// Where screening `changes` spends its time, per change judged: decoding them, their
/// operations placed (`inspect::Inspector`), and judging them, as screening does (what
/// is read at the same heads read once, `rules::Reads`) and afresh (`rules::judge`); of
/// that, reading the policy (`policy::of`) and, for scale, one read (the committer's
-/// member entry). As screening judges most: the first ones in (the maps they make, which flush
-/// the batch), the rest judged at the heads after them (`screen`'s frontier).
-fn screening_parts(changes: &[automerge::Change]) {
+/// member entry). As screening judges most: the first `warm` ones in (the maps they make,
+/// which flush the batch), the rest judged at the heads after them (`screen`'s frontier).
+fn screening_parts(changes: &[automerge::Change], warm: usize) {
use crate::access::{policy, rules};
use crate::document::at::At;
use crate::document::inspect::{Inspector, Op, Path};
use std::collections::{BTreeSet, HashMap};
- let warm = changes.len().min(400);
+ let warm = warm.min(changes.len());
let mut base = Document::new();
base.apply_changes(changes[..warm].to_vec()).expect("apply");
let rest = &changes[warm..];
@@ -778,8 +784,8 @@ fn screening_parts(changes: &[automerge::Change]) {
});
let per = |d: Duration| d.as_secs_f64() * 1e6 / rest.len().max(1) as f64;
println!(
- "{:<40} per change: decode {:.2} µs, place {:.2} µs, judge {:.2} µs (afresh {:.2} µs: policy::of {:.2} µs, one read {:.2} µs)",
- "",
+ "{:>40} per change: decode {:.2} µs, place {:.2} µs, judge {:.2} µs (afresh {:.2} µs: policy::of {:.2} µs, one read {:.2} µs)",
+ format!("after {warm}"),
per(decode),
per(place),
per(judge),