Add pool based memory resource#25325
Merged
achow101 merged 5 commits intobitcoin:masterfrom Apr 20, 2023
Merged
Conversation
6de57f7 to
d3c437f
Compare
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsNo conflicts as of last run. |
This was referenced Jun 10, 2022
850fe38 to
ba38016
Compare
Riahiamirreza
approved these changes
Jun 11, 2022
6932541 to
b56c223
Compare
9 tasks
98bb268 to
d196da1
Compare
d196da1 to
9205b60
Compare
Contributor
Author
|
rebased to 9205b60 with minor fixes in |
jonatack
approved these changes
Mar 24, 2023
Member
jonatack
left a comment
There was a problem hiding this comment.
Nice review work, @LarryRuane.
re-ACK 9f947fc
Contributor
|
ACK 9f947fc |
Contributor
Author
martinus
added a commit
to martinus/map_benchmark
that referenced
this pull request
Apr 4, 2023
Member
|
re-ACK 9f947fc |
Member
|
Posthumous utACK 9f947fc |
Contributor
Author
|
Wohoo 🎉 Thanks everyone for making this happen! |
1 task
This was referenced Nov 17, 2023
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
A memory resource similar to
std::pmr::unsynchronized_pool_resource, but optimized for node-based containers. The goal is to be able to cache more coins with the same memory usage, and allocate/deallocate faster.This is a reimplementation of #22702. The goal was to implement it in a way that is simpler to review & test
There is now a generic
PoolResourcefor allocating/deallocating memory. This has practically the same API asstd::pmr::memory_resource. (Unfortunately I cannot use std::pmr because libc++ simply doesn't implement that API).Thanks to sipa there is now a fuzzer for PoolResource! On a fast machine I ran it for ~770 million executions without finding any issue.
The estimation of the correct node size is now gone, PoolResource now has multiple pools and just needs to be created large enough to have space for the unordered_map nodes.
I ran benchmarks with #22702, mergebase, and this PR. Frequency locked Intel i7-8700, clang++ 13.0.1 to reindex up to block 690000.
The performance is practically identical with #22702, just 0.4% slower. It's ~21% faster than master:
Note that on cache drops mergebase's memory doesnt go so far down because it does not free the
CCoinsMapbucket array.