forked from Bitcoin-ABC/bitcoin-abc
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mempool: optimization of removeForBlock + general optimizations
Summary --- As discussed in issue Bitcoin-ABC#161, the performance of `removeForBlock` in particular is a critical path that deserves optimization. This MR significantly improves the performance of `removeForBlock` from 0% to as much as 100% or more, depending on the exact mempool layout in question. The changes introduced also happen to improve the general performance of the mempool as well. Minor RPC Change --- - As a result of these optimizations, the mempool-related RPC calls that describe a mempool entry's `spentby` (list of mempool txs that spend a particular mempool tx) have a different sort order now. Previously, this list would be sorted by txid. Now, it is sorted topologically. - `getmempooldescendants` and `getmempoolancestors` now also no longer returns a list that is sorted by `TxId` but is rather topologically sorted (by `entryId`). Test Plan --- - `ninja all check-all` Run these benches on master versus this MR commit: - `ninja bench_bitcoin && src/bench/bench_bitcoin -filter='(RemoveForBlock.*)|(MempoolAcc.*)|(Reorg.*)|(Generat.*)|(Evict.*)'`
- Loading branch information
Showing
4 changed files
with
53 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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