bench: arithmetic operation micro-benchmarks#39
Merged
Conversation
An op-level tier alongside the whole-model builds: one benchmark per (operation, size profile), operands built outside the measured region so a run isolates a single op rather than a whole build. This attributes perf changes to a specific arithmetic path — a build benchmark says "kvl got heavier", an op benchmark says "expr+expr broadcast got heavier". - benchmarks/ops.py: op registry (OpSpec) + size profiles (small 1D×2000; large 3D×3×4×1000 — differ in element count *and* dim count; the asymmetric shape also catches dim-order bugs) + ~30 ops across scaling, var/expr arithmetic, quadratic, reductions and constraint construction. Binary labelled ops carry match/broadcast variants — the alignment-path axis where the interesting regressions live. - benchmarks/drivers/test_ops.py: parametrized driver, one benchmark per (op, profile). - conftest: add test_ops to CODSPEED_MODULES (tracked; memory advisory). 60 benchmarks, ~80s/run with memory. Signal validates: large ≈ 6× small, broadcast ≈ 5× match (the §9 cross-product).
Collapse to one 3-D profile (3×4×1000, ~12 K elements) — CodSpeed records time *and* memory per benchmark, so a second size wasn't buying a separate signal; one multi-dim profile keeps broadcast/alignment coverage with MB-scale ops above the noise floor, and halves the matrix. Benchmark ids drop the size suffix. Add three categories: absence/masking (expr.where / fillna / absence propagation — §4–§7, the semantics-heavy surface), groupby.sum, and an N-way merge (constraint-assembly cost). 35 ops, ~45 s/run with memory.
Merging this PR will not alter performance
Performance Changes
Comparing Footnotes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Op-level benchmark tier (35 ops, one 3-D profile) to measure CodSpeed cost on the fork before upstreaming (PyPSA PyPSA#805). See benchmarks/ops.py.