fix(bench): honor --baseline in nearest-prefilter

Greptile follow-up: the scenario ignored the flag and ran the full query
loop, so a baseline/delta pair measured ~0 instead of the queries'
memory cost. Baseline now exits after seeding + optimize, matching
merge-all-changed's shape.
This commit is contained in:
aaltshuler 2026-07-05 15:22:19 +03:00 committed by Andrew Altshuler
parent c6b4a6ce2b
commit dd67adccd9

View file

@ -487,6 +487,17 @@ async fn nearest_prefilter(args: &Args) -> serde_json::Value {
db.optimize().await.expect("optimize"); db.optimize().await.expect("optimize");
let optimize_ms = optimize_start.elapsed().as_millis() as u64; let optimize_ms = optimize_start.elapsed().as_millis() as u64;
if args.baseline {
// Identical workload minus the measured query loop — see
// Args::baseline (the peak-RSS delta isolates the queries' cost).
return serde_json::json!({
"seed_ms": seed_ms,
"optimize_ms": optimize_ms,
"hit_rows": hit_rows,
"baseline": true,
});
}
// Query vector = +e1 (the "miss" cluster's pole): the global ANN top-k is // Query vector = +e1 (the "miss" cluster's pole): the global ANN top-k is
// dominated by non-matching rows by construction. // dominated by non-matching rows by construction.
let mut query_vec = vec![0.0f32; args.dims]; let mut query_vec = vec![0.0f32; args.dims];