[Bug] The lexicon performance test asserts on an average, not a best-of-N #638

Closed
opened 2026-07-22 16:23:36 +00:00 by brenno · 0 comments
Owner

Found in the pre-publication test review.

Evidence: test/privacy_bulk_lexicon_test.dart:246-257 runs 20 scans back to back and asserts the average against lessThan(5) ms. test/large_deck_performance_test.dart:112-121 solves the same problem correctly with fastestOf(3) — "returns the fastest run". There is no Timeout( in any test file, and dart_test.yaml defines no retry, tag or isolation for either of these.

Why this matters: an average over 20 runs is more sensitive to a single outlier than a minimum over 3, and under a full suite (516 test files, parallel isolates) that is the classic wall-clock trip. The first contributor running make check on a loaded laptop gets a red privacy performance test for a change to, say, a dialog — a failure with nothing to do with their work, which is the fastest way to teach someone that the gate is noise.

Proposal: move fastestOf from large_deck_performance_test.dart into test/support/ and reuse it here: final perScan = fastestOf(5, () => lexicon.findIn(text));. Same assertion, same threshold, no noise sensitivity.

Found in the pre-publication test review. **Evidence:** `test/privacy_bulk_lexicon_test.dart:246-257` runs 20 scans back to back and asserts the **average** against `lessThan(5)` ms. `test/large_deck_performance_test.dart:112-121` solves the same problem correctly with `fastestOf(3)` — "returns the fastest run". There is no `Timeout(` in any test file, and `dart_test.yaml` defines no retry, tag or isolation for either of these. **Why this matters:** an average over 20 runs is more sensitive to a single outlier than a minimum over 3, and under a full suite (516 test files, parallel isolates) that is the classic wall-clock trip. The first contributor running `make check` on a loaded laptop gets a red privacy performance test for a change to, say, a dialog — a failure with nothing to do with their work, which is the fastest way to teach someone that the gate is noise. **Proposal:** move `fastestOf` from `large_deck_performance_test.dart` into `test/support/` and reuse it here: `final perScan = fastestOf(5, () => lexicon.findIn(text));`. Same assertion, same threshold, no noise sensitivity.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
LibreKAT/Ocideck#638
No description provided.