Skip to content

Unify aggregation, real RSS, Bencher prep (#40) - #3

Open
m-hu wants to merge 1 commit into
masterfrom
fix/40-comparability
Open

m-hu wants to merge 1 commit into
masterfrom
fix/40-comparability

Conversation

@m-hu

@m-hu m-hu commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Part of hhh-pa/clojure-code-snippet#40 — the python-side comparability
work: same aggregation rule, real memory signal, Bencher history prep.

Changes

  • tools/measure.py: instructions Σ-median → callgrind_instructions
    Σ-min with lower/upper bounds, plus peak_memory — mirroring the twin
    BMF shape. Runs restructure to the lean recipe: --repeat native runs
    under GNU time (fail-fast without it; BSD time rejected) +
    --callgrind-repeat Ir-only runs. maxrss_kb/cpu_s are real now
    (were 0/wall-fallback).
  • test.yml: installs time; tracks callgrind_instructions at 0.01
    boundary (was instructions/0.10), matching clojure; strip-to-tracked,
    skip-if-empty, and a visible warning while the Bencher key is unset.
  • Rule documented in the measure.py docstring, workflow comments, and
    README perf section.

Validation

  • measure.py --self-test passes (new time-parse/reject, Σ-min/bounds/
    peak asserts, merge fan-in tests).
  • Full functional test with fake GNU time + valgrind: Σ-min, bounds,
    peak, summary table, no-valgrind degradation, mismatch→exit 1 — all
    correct. No benchmark renames proven (old-vs-new BMF keys identical,
    393/393 match live CI keys).

Blocked on maintainer

BENCHER_API_KEY is not set on this repo (only RESOURCES_PASSPHRASE
exists) — history arms after the secret + project exist (10 samples).
Everything else is code-complete.

AI-Tool: Muse Code (Meta Muse Spark)

Make the CPython leg comparable with the clojure twin:

- Aggregation: callgrind_instructions is now the sum of per-case MINs
  (was per-case medians), matching the JVM/clojure-rs least-disturbed
  rule; cpu_time keeps the shared sum-of-medians rule. Benchmark names
  are byte-identical (proven old-vs-new on identical input).
- Measure names converge on the twin: instructions -> callgrind_-
  instructions with lower/upper bounds; new peak_memory (max per-case
  median RSS in bytes, mirroring the twin's PeakMemory).
- Every case now runs natively under GNU time (required, fail-fast
  without it) for real cpu_s/maxrss_kb instead of maxrss=0/wall-cpu
  approximations; Callgrind runs carry Ir only (--callgrind-repeat).
  CI installs GNU time; summary table gains a Peak RSS column.
- Bencher: track callgrind_instructions with the twin's threshold
  shape (percentage, 10/64 samples, 1% boundary), strip repeat-1
  cpu/peak before reporting, and warn visibly while BENCHER_API_KEY
  is unset (history needs a maintainer to create the Bencher project
  and set the secret).

AI-Tool: Muse Code (Meta Muse Spark)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant