Page MenuHomePhabricator

Use PoolAllocator for CCoinsMap
ClosedPublic

Authored by PiRK on May 16 2024, 14:40.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC4bf7aca6146c: Use PoolAllocator for CCoinsMap
Summary

In my benchmarks, using this pool allocator for CCoinsMap gives about 20% faster -reindex-chainstate with -dbcache=5000 with practically the same memory usage. The change in max RSS changed was 0.3%.

The validation_flush_tests tests need to be updated because memory allocation is now done in large pools instead of one node at a time, so the limits need to be updated accordingly.

This is a partial backport of core#25325
https://github.com/bitcoin/bitcoin/pull/25325/commits/9f947fc3d4b779f017332135323b34e8f216f613

with a fix from core#28913

Depends on D16177

Benchmark on a 12 cores AMD CPU, with the data on a spinning harddrive, using the default dbcache (1024 MB):

time src/bitcoind -reindex-chainstate -stopatheight=400000 -assumevalid=000000000000000004ec466ce4732fe6f1ed1cddc2ed4b328fff5224276e3f6f

Before:

real 96m2s
user 27m27s
sys 2min58s

After:

real 74m22s
user 23m39s
sys 2min23s
Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

@bot build-linux32 build-linux-arm

PiRK published this revision for review.May 17 2024, 17:30
PiRK edited the test plan for this revision. (Show Details)
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/test/coins_tests.cpp
1056 ↗(On Diff #47821)

Would be nice to use the appropriated boost macros here, BOOST_CHECK_LE and BOOST_CHECK_LT (not in this diff)

This revision is now accepted and ready to land.May 20 2024, 08:27
This revision was automatically updated to reflect the committed changes.

Same benchmark with the data on a SSD disk:

Before:

real	23m33,219s
user	24m10,745s
sys	2m14,790s

After:

real	22m7,117s
user	22m8,816s
sys	1m53,144s