perf(db): open MDBX DBIs only once at startup#18424
Merged
shekhirin merged 1 commit intoparadigmxyz:mainfrom Sep 15, 2025
Merged
perf(db): open MDBX DBIs only once at startup#18424shekhirin merged 1 commit intoparadigmxyz:mainfrom
shekhirin merged 1 commit intoparadigmxyz:mainfrom
Conversation
hai-rise
commented
Sep 13, 2025
| /// More generally, do not dynamically create, re-open, or drop tables at | ||
| /// runtime. It's better to perform table creation and migration only once | ||
| /// at startup. | ||
| dbis: Arc<HashMap<&'static str, ffi::MDBX_dbi>>, |
Contributor
Author
There was a problem hiding this comment.
I tried &'static and it was ~0.3% faster than Arc, but reverted for consistency with the rest of the code base. We can review and make several things (like also the DB environment, etc.) &'static together later.
shekhirin
approved these changes
Sep 15, 2025
Member
shekhirin
left a comment
There was a problem hiding this comment.
LGTM, nice! In theory we should even be able to make it a match, because tables are known during compile-time, but let's not bother with this for now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 2 of #18292: Cache DBIs at startup time to reuse throughout the program's lifetime instead of just per transaction.
reth-benchfor the first 300 blocks of Shanghai:f66e197 (
main):This branch on f66e197:
Speedup: