Skip to content

Comments

perf(database): add reserve calls in merge_transitions and extend_state#3430

Merged
rakita merged 1 commit intomainfrom
danipopes/reserve-in-merge-transitions
Feb 23, 2026
Merged

perf(database): add reserve calls in merge_transitions and extend_state#3430
rakita merged 1 commit intomainfrom
danipopes/reserve-in-merge-transitions

Conversation

@gakonst
Copy link
Collaborator

@gakonst gakonst commented Feb 19, 2026

Summary

Pre-allocate hashmap capacity before inserting in loops to reduce rehashing overhead.

Changes

  • apply_transitions_and_create_reverts: reserve self.state for incoming transitions
  • update_and_create_revert / extend_storage: reserve this_storage for storage_update
  • extend_state: reserve self.state for other_state, and this.storage for per-account storage

Prompted by: DaniPopes

Pre-allocate capacity for hashmaps before inserting in loops to reduce
rehashing overhead in hot paths.

Amp-Thread-ID: https://ampcode.com/threads/T-019c7525-35b9-719c-8fd1-f8aa014c2235
Co-authored-by: Amp <amp@ampcode.com>
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 19, 2026

Merging this PR will not alter performance

✅ 176 untouched benchmarks


Comparing danipopes/reserve-in-merge-transitions (de202c2) with main (3bccc97)

Open in CodSpeed

@rakita rakita merged commit 026017c into main Feb 23, 2026
31 checks passed
@rakita rakita deleted the danipopes/reserve-in-merge-transitions branch February 23, 2026 10:41
@github-actions github-actions bot mentioned this pull request Feb 16, 2026
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.

3 participants