Skip to content

Commit 2fb39bc

Browse files
tests/benchmarks/conftest.py for i in range(count): write_jsonl(project / f"session_{i:04d}.jsonl", 20) # Unique first_timestamp per session so export filenames do not collide in ZIP benches. first_ts = f"2026-06-12T{i % 24:02d}:{i % 60:02d}:00Z" @timon0305 timon0305 1 minute ago Member first_ts = f"2026-06-12T{i % 24:02d}:{i % 60:02d}:00Z" is only unique for count ≤ 120 (collides at lcm(24,60)). Add assert count <= 120 (or a wider format) so a future corpus bump can't produce colliding ZIP entries.
1 parent 0f5e1ab commit 2fb39bc

6 files changed

Lines changed: 24 additions & 24 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ coverage/
1616
coverage.xml
1717
benchmark-results.json
1818
benchmarks/_raw.json
19+
benchmarks/_ci/

benchmarks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The `benchmarks` job on **ubuntu-latest** runs pytest-benchmark (`--benchmark-js
4040

4141
**Gated:** parse medium/large + large peak memory; export 10/50/100 session latency + ZIP peak memory.
4242

43-
**Not gated (informational only):** `test_parse_session_small`, `test_search_full_corpus` (sub-ms CI noise), and the `cache` group. These names are omitted from `baselines.json` when using `reduce_baselines.py`. Benchmarks without a baseline entry print a warning and do not fail the gate.
43+
**Not gated (informational only):** `test_parse_session_small`, `test_search_full_corpus` (sub-ms CI noise), and the `cache` group. These may appear in `baselines.json` for reference but are skipped by `check_benchmark_regression.py`. Benchmarks without a baseline entry print a warning and do not fail the gate.
4444

4545
Missing gated benchmarks (renamed or removed tests still listed in `baselines.json`) fail the gate.
4646

benchmarks/baselines.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
{
2-
"_note": "Gated means from ubuntu-latest CI benchmark-results.json (PR memory-path benchmarks). Values multiplied by 1.5× slack at seeding time. Excluded from gate (not in this file): test_parse_session_small, test_search_full_corpus (CI noise). Memory benchmarks use extra_info.peak_bytes (bytes); latency uses stats.mean (seconds).",
3-
"updated": "2026-06-25T12:00:00Z",
2+
"_note": "Gated means from ubuntu-latest CI benchmark-results.json (PR #97, run 28126772276). Excluded from gate (recorded for reference): test_parse_session_small, test_search_full_corpus (sub-ms CI noise). Memory benchmarks use extra_info.peak_bytes (bytes); latency uses stats.mean (seconds).",
3+
"updated": "2026-06-24T20:15:37Z",
44
"machine": "Linux",
55
"groups": {
66
"parse": {
7-
"test_parse_session_medium": 0.003037,
8-
"test_parse_session_large": 0.030266,
7+
"test_parse_session_small": 0.00010518068718225604,
8+
"test_parse_session_medium": 0.002991333112179635,
9+
"test_parse_session_large": 0.032311203818181436,
910
"test_parse_large_peak_memory": 2032028.0
1011
},
1112
"export": {
12-
"test_bulk_export_session_count[sessions-10]": 0.004253,
13-
"test_bulk_export_session_count[sessions-50]": 0.021039,
14-
"test_bulk_export_session_count[sessions-100]": 0.041709,
15-
"test_bulk_export_zip_peak_memory[sessions-10]": 350546.0,
16-
"test_bulk_export_zip_peak_memory[sessions-50]": 503331.0,
17-
"test_bulk_export_zip_peak_memory[sessions-100]": 686874.0
13+
"test_bulk_export_session_count[sessions-10]": 0.0042825538530803925,
14+
"test_bulk_export_session_count[sessions-50]": 0.021406330209302382,
15+
"test_bulk_export_session_count[sessions-100]": 0.04229194749999898,
16+
"test_bulk_export_zip_peak_memory[sessions-10]": 350628.0,
17+
"test_bulk_export_zip_peak_memory[sessions-50]": 506454.0,
18+
"test_bulk_export_zip_peak_memory[sessions-100]": 694088.0
19+
},
20+
"search": {
21+
"test_search_full_corpus": 0.0011120838654706596
1822
}
1923
}
2024
}

scripts/reduce_baselines.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from pathlib import Path
1010

1111
from scripts.check_benchmark_regression import (
12-
EXCLUDED_FROM_GATE,
1312
BenchmarkDataError,
1413
benchmark_entry_mean,
1514
)
@@ -59,25 +58,20 @@ def reduce_baselines(
5958
f"{path} benchmarks[{index}] missing 'name' or measurable value"
6059
) from exc
6160
bench_name = str(name)
62-
if bench_name in EXCLUDED_FROM_GATE:
63-
continue
6461
group = entry.get("group")
6562
if group not in GATED_GROUPS:
6663
continue
6764
groups[group][bench_name] = mean * slack
6865

69-
# Drop empty groups (e.g. search when only excluded benchmarks ran).
70-
groups = {name: values for name, values in groups.items() if values}
71-
7266
slack_note = f" Values multiplied by {slack}× slack at generation time." if slack != 1.0 else ""
7367
machine_info = raw.get("machine_info")
7468
machine = machine_info.get("system") if isinstance(machine_info, dict) else None
7569
output: dict[str, object] = {
7670
"_note": (
7771
"Gated means from ubuntu-latest CI benchmark-results.json."
7872
f"{slack_note} "
79-
"Excluded from gate (not written here): test_parse_session_small, "
80-
"test_search_full_corpus (CI noise). "
73+
"Excluded from gate (recorded for reference): test_parse_session_small, "
74+
"test_search_full_corpus (sub-ms CI noise). "
8175
"Memory benchmarks use extra_info.peak_bytes (bytes); "
8276
"latency uses stats.mean (seconds)."
8377
),

tests/benchmarks/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def export_corpus(tmp_path: Path, request: pytest.FixtureRequest) -> Path:
102102
project.mkdir()
103103
for i in range(count):
104104
# Unique first_timestamp per session so export filenames do not collide in ZIP benches.
105-
first_ts = f"2026-06-12T{i % 24:02d}:{i % 60:02d}:00Z"
105+
first_ts = f"2026-06-12T{i // 60:02d}:{i % 60:02d}:00Z"
106106
write_jsonl(project / f"session_{i:04d}.jsonl", 20, first_timestamp=first_ts)
107107
return project
108108

tests/test_reduce_baselines.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ def test_reduce_baselines_writes_gated_groups_only(tmp_path) -> None:
3838
output = reduce_baselines(raw, out)
3939

4040
assert output["machine"] == "Linux"
41+
assert set(output["groups"].keys()) == {"parse", "export", "search"}
4142
assert "test_parse_session_medium" in output["groups"]["parse"]
42-
assert "test_parse_session_small" not in output["groups"]["parse"]
43+
assert "test_parse_session_small" in output["groups"]["parse"]
44+
assert output["groups"]["search"] == {}
4345
assert "cache" not in output["groups"]
4446

4547

46-
def test_reduce_baselines_skips_excluded_from_gate(tmp_path) -> None:
48+
def test_reduce_baselines_includes_search_benchmark(tmp_path) -> None:
4749
raw = tmp_path / "raw.json"
4850
out = tmp_path / "baselines.json"
4951
_write_raw(
@@ -56,8 +58,7 @@ def test_reduce_baselines_skips_excluded_from_gate(tmp_path) -> None:
5658

5759
output = reduce_baselines(raw, out)
5860

59-
assert "search" not in output["groups"]
60-
assert "test_search_full_corpus" not in json.loads(out.read_text(encoding="utf-8"))["groups"]
61+
assert output["groups"]["search"]["test_search_full_corpus"] == pytest.approx(0.001)
6162

6263

6364
def test_reduce_baselines_applies_slack(tmp_path) -> None:

0 commit comments

Comments
 (0)