Skip to content

bench(freqhb): Generate datasets lazily to cut peak RSS#27

Merged
jqnatividad merged 1 commit into
masterfrom
fix/freqhb-bench-peak-rss
Jun 4, 2026
Merged

bench(freqhb): Generate datasets lazily to cut peak RSS#27
jqnatividad merged 1 commit into
masterfrom
fix/freqhb-bench-peak-rss

Conversation

@jqnatividad

Copy link
Copy Markdown
Collaborator

Follow-up to #26, which was merged before this Copilot-review fix could be pushed.

What

Copilot flagged that benches/freqhb.rs eagerly materialized every shape's 1M-row dataset and kept them all resident at once (~190MB peak in bench_build), even though each benchmark only needs one shape at a time.

This restructures both bench_build and bench_merge to pull from a shapes() table of boxed generator closures, building each dataset inside the loop so only a single ~1M-row Vec<Vec<u8>> is resident at a time. bench_merge additionally drops the source dataset after the partial tables are built (the partials own their keys), trimming peak further.

Matches the lazy-generation pattern already used in benches/sortcmp.rs.

Notes

  • Behavior/measurements unchanged — same shapes, same data (deterministic LCG seeds), same iteration counts; only allocation lifetime changes.
  • No library code touched; bench-only.

Test plan

  • cargo bench --bench freqhb --no-run — compiles clean

🤖 Generated with Claude Code

Addresses Copilot review feedback on PR #26 (merged before this fix was
pushed). The bench previously materialized all shapes' 1M-row datasets up
front and held them resident simultaneously (~190MB in bench_build), when
each benchmark only needs one shape at a time.

Datasets are now produced by a shapes() table of boxed generator closures
and built inside the loop, so a single ~1M-row Vec<Vec<u8>> is resident at
a time. bench_merge additionally drops the source dataset after building
the partial tables (the partials own their keys), trimming peak further.
Matches the lazy-generation pattern already used in benches/sortcmp.rs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jqnatividad
jqnatividad merged commit ff07564 into master Jun 4, 2026
@jqnatividad
jqnatividad deleted the fix/freqhb-bench-peak-rss branch June 4, 2026 10: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