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
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D16178