- Make the removed and conflicted arguments to the CTxMemPool::remove* functions optionals, avoiding building full lists of those when we don’t need them.
- Use std::vector instead of std::list for those lists, which have lower allocation overhead (std::list only has an advantage when you need frequent inserts or deletions not at the end).
- Switch those lists to returning std::shared_ptrs instead, so no full copying is needed.
A few mempool removal optimizations #8515
pull sipa wants to merge 4 commits into bitcoin:master from sipa:moresharedmem changing 7 files +51 −50-
sipa commented at 11:30 am on August 15, 2016: member
-
MarcoFalke added the label Mempool on Aug 15, 2016
-
MarcoFalke added the label Refactoring on Aug 15, 2016
-
jonasschnelli commented at 11:56 am on August 15, 2016: contributorUsing shared pointers makes much more sense. Thanks. utACK eb8104aebccd42bbd28f33ea0f2e100cccdf42f7.
-
sipa force-pushed on Aug 15, 2016
-
sipa commented at 10:37 am on August 25, 2016: memberAnyone feel like benchmarking whether this has an impact on invalidateblock/reconsiderblock times (mimicking a large reorg)?
-
in src/txmempool.h: in fb464c8c56 outdated
5@@ -6,7 +6,6 @@ 6 #ifndef BITCOIN_TXMEMPOOL_H 7 #define BITCOIN_TXMEMPOOL_H 8 9-#include <list> 10 #include <memory> 11 #include <set>
luke-jr commented at 9:29 pm on August 27, 2016:Shouldn’t there be<vector>
here?
sipa commented at 11:20 pm on August 27, 2016:Note:<vector>
does not render, unless inside
sipa commented at 11:28 pm on August 27, 2016:Added some missing includes (map for std::map, utility for std::pair, vector for std::vector, string for std::string). I’m sure we have many more cases of these missing though. -
in src/txmempool.cpp: in 17df3fdc83 outdated
557 indexed_transaction_set::const_iterator it2 = mapTx.find(txin.prevout.hash); 558 if (it2 != mapTx.end()) 559 continue; 560 const CCoins *coins = pcoins->AccessCoins(txin.prevout.hash); 561- if (nCheckFrequency != 0) assert(coins); 562+ if (nCheckFrequency != 0) assert(coins);
luke-jr commented at 9:32 pm on August 27, 2016:What changed here?
rebroad commented at 2:09 am on August 30, 2016:a space was missing -
in src/txmempool.cpp: in fb464c8c56 outdated
559 indexed_transaction_set::const_iterator it2 = mapTx.find(txin.prevout.hash); 560 if (it2 != mapTx.end()) 561 continue; 562 const CCoins *coins = pcoins->AccessCoins(txin.prevout.hash); 563- if (nCheckFrequency != 0) assert(coins); 564+ if (nCheckFrequency != 0) assert(coins);
sipa commented at 10:13 pm on August 27, 2016:Incorrect indentation. -
luke-jr commented at 10:20 pm on August 27, 2016: member
ACK
Benchmarked c072b8fd95cd4fa84f08189a0cd8b173ea2dbb8e vs c072b8fd95cd4fa84f08189a0cd8b173ea2dbb8e + fb464c8c5670e94bd429786e7c8985c4100da811 with testnet blocks 925000-925617 (000000000000020c778212bbe3cdd2ad7f2d102ff4c3ae39515b8008c170d9f6) with no measurable real-time performance difference (~1m10s invalidate, ~30s reconsider)
-
sipa force-pushed on Sep 9, 2016
-
sipa commented at 4:29 pm on September 9, 2016: memberRebased.
-
laanwj commented at 8:58 pm on October 18, 2016: memberutACK, needs rebase again though
-
sipa force-pushed on Oct 20, 2016
-
sipa commented at 6:16 pm on October 20, 2016: memberRebased.
-
TheBlueMatt commented at 5:49 pm on October 21, 2016: memberutACK 6ee761c83e3eeea8c685f789758232a1c4325f99.
-
Bypass removeRecursive in removeForReorg f48211b700
-
Make removed and conflicted arguments optional to remove 51f278329d
-
Return shared_ptr<CTransaction> from mempool removes 4100499db4
-
Add some missing includes 0334430b39
-
sipa force-pushed on Oct 22, 2016
-
laanwj merged this on Oct 25, 2016
-
laanwj closed this on Oct 25, 2016
-
laanwj referenced this in commit 9bdf5269f8 on Oct 25, 2016
-
codablock referenced this in commit 24c0193c35 on Sep 19, 2017
-
codablock referenced this in commit 5bcd438b13 on Jan 13, 2018
-
gladcow referenced this in commit b98c102202 on Mar 2, 2018
-
gladcow referenced this in commit f68c64c6bb on Mar 13, 2018
-
gladcow referenced this in commit d66aa72841 on Mar 14, 2018
-
gladcow referenced this in commit afa025b964 on Mar 15, 2018
-
gladcow referenced this in commit 5c27de4fd7 on Mar 15, 2018
-
gladcow referenced this in commit 88a4e0c2a7 on Mar 15, 2018
-
gladcow referenced this in commit ada8cdadd8 on Mar 15, 2018
-
gladcow referenced this in commit fc8be4768e on Mar 24, 2018
-
gladcow referenced this in commit bc47ef3db2 on Apr 4, 2018
-
UdjinM6 referenced this in commit bc45a2f87a on Apr 11, 2018
-
andvgal referenced this in commit b0467d226b on Jan 6, 2019
-
andvgal referenced this in commit fd5c50bc2b on Jan 6, 2019
-
CryptoCentric referenced this in commit f35d8264cc on Feb 15, 2019
-
CryptoCentric referenced this in commit dd3fd51204 on Feb 28, 2019
-
furszy referenced this in commit 1f010c0969 on Jan 23, 2021
-
DrahtBot locked this on Sep 8, 2021