Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch in-memory index to hash set #4665

Merged

Conversation

SirTyson
Copy link
Contributor

Description

Significantly improve in-memory bucket performance.

This PR changes in-memory buckets from a vector to an unordered_set. This doubles median lookup speed, but more importantly removes all slow outliers seen with the vector approach (as tested on my laptop). To keep the minimum possible memory footprint, I've created a bit of a hacky set which stores an impl class. The impl can either be a key type or a value type. The intention is the set only stores value type entries, but key type entries can be used for querying. C++20 introduces transparent hashes which accomplish the same goal, but in a much cleaner, more statically typesafe way, so we should refactor this once we upgrade.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

@SirTyson SirTyson requested a review from marta-lokhova March 11, 2025 17:06
Copy link
Contributor

@marta-lokhova marta-lokhova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, just a few questions

@marta-lokhova marta-lokhova enabled auto-merge March 22, 2025 00:26
marta-lokhova
marta-lokhova previously approved these changes Mar 22, 2025
@marta-lokhova marta-lokhova added this pull request to the merge queue Mar 22, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 22, 2025
@marta-lokhova marta-lokhova added this pull request to the merge queue Mar 22, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 22, 2025
@marta-lokhova
Copy link
Contributor

@SirTyson ah looks like this PR didn't merge due to some status check failures

@SirTyson SirTyson added this pull request to the merge queue Mar 24, 2025
@SirTyson SirTyson removed this pull request from the merge queue due to a manual request Mar 24, 2025
@marta-lokhova marta-lokhova enabled auto-merge March 24, 2025 17:56
@marta-lokhova marta-lokhova added this pull request to the merge queue Mar 24, 2025
Merged via the queue into stellar:master with commit 91ce086 Mar 24, 2025
13 checks passed
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.

2 participants