Skip to content

feat: extra_info label columns in compare (--columns extra:NAME)#177

Merged
FBumann merged 2 commits into
mainfrom
feat/extra-info-columns
Jul 24, 2026
Merged

feat: extra_info label columns in compare (--columns extra:NAME)#177
FBumann merged 2 commits into
mainfrom
feat/extra-info-columns

Conversation

@FBumann

@FBumann FBumann commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Note

The following content was generated by AI.

--columns now accepts extra:NAME alongside the metric names: it renders the numeric extra_info value NAME as a plain, stat-less label column — one readout per (benchmark × series), count-formatted, with no (N.NN) multiplier and no ranking colour (a label describes the benchmark, it doesn't compete).

benchmem compare baseline.json candidate.json --columns time,peak,extra:variables --stat min

Behavior details:

  • Values load per series, so a label that legitimately differs between runs (a model size after a formulation change) shows both values; the --diff view diffs it like a metric (Δ% per comparison run).
  • Non-numeric extra_info values are skipped; like a metric, a label absent from every run is dropped, and one absent from a single series shows .
  • Works in both renderers (rich terminal + --format md), with label-only --columns extra:... supported, and flows into --csv.
  • Names resolve over the same flat dim namespace as --pivot (params + extra_info); extra: disambiguates from metric names.

Implementation: _resolve_columns admits extra:NAME, _load_columns collects the labels from the long df it already walks (a stat-less extra:NAME column id via the new _col_id helper), and the table/diff renderers suppress multiplier/colour for label columns. 7 new tests in tests/test_compare.py; docs updated in docs/compare-runs.md. Full suite: 347 passed; ruff + mypy clean.

Motivating use: fluxopt's reference benchmarks record model-size labels (variables, flows, component counts) in extra_info — this lets its benchmark-hint PR comment show them next to time/peak (fluxopt/fluxopt#268).

🤖 Generated with Claude Code

--columns now accepts extra:NAME entries alongside the metric names.
Each one renders the numeric extra_info value NAME as a plain,
stat-less label column: one readout per (benchmark x series), count-
formatted, with no (N.NN) multiplier and no ranking colour — a label
describes the benchmark, it doesn't compete. Values load per series,
so a label that legitimately differs between runs (a model size after
a formulation change) shows both values, and the --diff view diffs it
like a metric. Non-numeric values are skipped; like a metric, a label
absent from every run is dropped.

Motivating use: benchmarks that record model-size labels in extra_info
(variables, constraints, component counts) can now surface them in the
compare table and markdown PR comments next to time/peak.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@read-the-docs-community

read-the-docs-community Bot commented Jul 24, 2026

Copy link
Copy Markdown

Documentation build overview

📚 pytest-benchmem | 🛠️ Build #33741334 | 📁 Comparing 3c4ae3c against latest (5f55732)

  🔍 Preview build  

4 files changed
± compare-runs/index.html
± reference/index.html
± visualize/index.html
± gallery/linopy-memory/index.html

Review fixes for the extra_info label columns:

- Keep labels (and the run's benchmarks) when every requested metric is
  absent from every run — the label-only fallback now triggers on no
  labels loaded, not on no metrics requested, so
  'compare --columns rss,extra:variables' on non-isolated runs renders
  the labels instead of dying with 'no benchmarks found'.
- Format non-integral labels with a new fmt_label (4 sig figs) instead
  of fmt_count, which silently truncated 0.85 to 0.
- Reject extra:NAME for the long frame's reserved columns
  (snapshot/id/value) — extra:value used to silently render metric
  values as a label.
- DRY the renderers: _Col.is_label carries the 'a label doesn't
  compete' rule, and a shared _col_header builds the header text for
  both the rich and markdown views.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@FBumann
FBumann merged commit 40a25f5 into main Jul 24, 2026
12 checks passed
@FBumann
FBumann deleted the feat/extra-info-columns branch July 24, 2026 10:07
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