Skip to content

Move the benchmark entry point to numpy_groupies.benchmarks - #125

Merged
ml31415 merged 6 commits into
masterfrom
benchmarks-entry-point
Oct 16, 2026
Merged

ml31415 merged 6 commits into
masterfrom
benchmarks-entry-point

Conversation

@ml31415

@ml31415 ml31415 commented Oct 16, 2026

Copy link
Copy Markdown
Owner

simple.py is gone

It printed three usage examples, checked nine functions against a group-and-loop reference and timed those nine over 100,000 values. All three are covered elsewhere: the examples are in the README, the comparison is test_compare.py (over every implementation pair and far more functions), and the timing is this module's table (40 functions, --size 1e5 gives the same data set). It also still went through the aggregate_np/aggregate_py aliases.

The one thing worth keeping was its np-grouploop column: the same numpy implementation with its fast path disabled, i.e. what a func the implementation does not recognise costs. generic.py still carried the helper for it, unused since the rework - it is now _grouploop.py and an opt-in column, in line with _pandas.py and _ufunc.py:

function              ufunc         numpy     grouploop         numba
---------------------------------------------------------------------
sum                   0.130         0.094         4.259         0.060
arbitrary              ----         7.092         7.158         1.705
sort                   ----         4.216          ----         0.593

---- where no per-group callable can express the function (the cumulatives, the argreductions, sort); arbitrary is a custom callable and lands on the group-loop path by itself, which is why numpy and grouploop agree there.

The entry point

generic.py is the package __init__.py and a five-line __main__.py runs it, because python -m on a package executes __main__.py and not the __init__.py:

python -m numpy_groupies.benchmarks --pandas --numbagg
uv run -m numpy_groupies.benchmarks --sort --runs=3

The --help header, the README and the two commands in docs/benchmarks.md follow the new name; the --grouploop column is documented next to the other opt-in ones.

OCCAM Coder added 6 commits October 16, 2026 13:18
- generic.py becomes the package __init__, __main__.py makes python -m numpy_groupies.benchmarks work
- drop simple.py: its nine functions, its 100k data set and its group-and-loop reference are covered by the module and by test_compare
- measure the numpy group-and-loop path as a _grouploop implementation behind --grouploop
- single run: rows go to stdout as they are measured, no summary after them
- several runs: a counter on stderr, the merged table on stdout once
- the live rows carry the column header
- end a piped run quietly on a closed reader
- measure numpy and numba by default, everything else behind its own flag
- add --all for the optional columns and build the table from COLUMN_ORDER
- put purepy behind --purepy
- drop the live rows when the measurement is repeated
- move the column explanations into --help, leave the docs pointing at it
- rerun the full table with --ufunc --numbagg --pandas --runs=3
- rerun the sort sweep with --sort --runs=3
- state the new column order in both tables
- restate the ratios in the prose from the new numbers
@ml31415
ml31415 merged commit 991ae6d into master Oct 16, 2026
6 checks passed
@ml31415
ml31415 deleted the benchmarks-entry-point branch October 20, 2026 08:51
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