Skip to content

Number benchmark jobs sequentially in river bench - #1379

Draft
bgentry wants to merge 1 commit into
masterfrom
bg/bench-job-numbers
Draft

bgentry wants to merge 1 commit into
masterfrom
bg/bench-job-numbers

Conversation

@bgentry

@bgentry bgentry commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

DRAFT: not ready for review. Opened for evaluation; this may change before it is marked ready.

river bench is meant to give each inserted job a unique num arg, but the insert loops set Num on a copy of each batch element, so every job goes in as num: 0.

This replaces the separate args batch with a helper that writes a numbered BenchmarkArgs straight into each insert-params element and continues the count from one batch to the next. Both the fixed-count and continuous insert modes use it. A new test runs the fixed-count insert path across two batches and checks the inserted jobs are numbered from 1 to N.

`river bench` intends to give every inserted job a unique `num` arg,
but its insert loops range over the args batch by value and increment
`Num` on a copy. The batch itself is never modified, so every job it
inserts carries `num: 0`.

Replace the separate args batch with a small helper that writes a
fresh `BenchmarkArgs{Num: ...}` into each insert params element and
returns the last number used, so numbering continues across batches.
Both the fixed-count and continuous insert modes share the helper. The
extra args slice didn't save any allocations anyway because each
`BenchmarkArgs` value was boxed into the `Args` interface on
assignment.

Add a test that runs the fixed-count insert path across two batches
and checks that the inserted jobs are numbered `1..N`.
@bgentry
bgentry force-pushed the bg/bench-job-numbers branch from 4b7c006 to 52b3880 Compare September 24, 2026 17:35
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