aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-08 19:41:35 +0000
committertv <tv@krebsco.de>2026-11-08 20:42:17 +0100
commit447ba15b16d71fe4c2285c4337aa99fe7b5d9df6 (patch)
treebd00b0f92eaa3fa95bdcf1084c404d9756c12afa
parentdff76228f103f36118f19c4492e20cd46f234fb8 (diff)
bench: break screening down after a long history too
The breakdown judges at the heads after 400 changes. Whether a read at given heads costs more in a document with a long history decides what a read the rules don't keep costs a node with a big document. For the workloads of more than 10000 changes, break it down a second time, judging the last 1000 at the heads after the rest.
-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),