Skip to content

refactor: optimize value pool allocation in benchmarks#121

Merged
TKorr merged 1 commit intomainfrom
fix/benchmark
Apr 28, 2026
Merged

refactor: optimize value pool allocation in benchmarks#121
TKorr merged 1 commit intomainfrom
fix/benchmark

Conversation

@TKorr
Copy link
Copy Markdown
Contributor

@TKorr TKorr commented Apr 27, 2026

  • Replaced build_value_pool with preallocate_values to pre-allocate Arc<u64> instances for each key in the universe.
  • This change reduces allocation overhead during benchmark runs, isolating policy behavior from allocator variance by only incurring the cost of Arc::clone per insert.
  • Updated benchmark functions to utilize the new preallocation method, enhancing performance measurement accuracy.

These modifications improve the efficiency of benchmark tests and ensure more reliable performance metrics.

Description

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test addition or modification

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual testing

Test environment:

  • OS:
  • Rust version:

Checklist

  • My code follows the project's coding standards
  • I have run cargo fmt and cargo clippy
  • I have added tests for my changes
  • All new and existing tests pass (cargo test)
  • I have updated the documentation as needed
  • I have added an entry to CHANGELOG.md (if applicable)

Screenshots (if applicable)

Additional Notes

- Replaced `build_value_pool` with `preallocate_values` to pre-allocate `Arc<u64>` instances for each key in the universe.
- This change reduces allocation overhead during benchmark runs, isolating policy behavior from allocator variance by only incurring the cost of `Arc::clone` per insert.
- Updated benchmark functions to utilize the new preallocation method, enhancing performance measurement accuracy.

These modifications improve the efficiency of benchmark tests and ensure more reliable performance metrics.
@TKorr TKorr merged commit 1b5efc9 into main Apr 28, 2026
18 checks passed
@TKorr TKorr deleted the fix/benchmark branch April 28, 2026 08:25
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