diff options
| author | MarcoFalke <[email protected]> | 2019-05-15 11:32:23 -0400 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2019-05-15 11:32:29 -0400 |
| commit | 2d16fb7a2b6a9e5a2535295d2de03e27c2438d1f (patch) | |
| tree | 795c54035c96f169eccac7299582fabfa024ced7 /src/rpc/blockchain.cpp | |
| parent | Merge #15777: [docs] Add doxygen comments for keypool classes (diff) | |
| parent | rpc: Speedup getrawmempool when verbose=true (diff) | |
| download | discoin-2d16fb7a2b6a9e5a2535295d2de03e27c2438d1f.tar.xz discoin-2d16fb7a2b6a9e5a2535295d2de03e27c2438d1f.zip | |
Merge #14984: rpc: Speedup getrawmempool when verbose=true
2d5cf4c41d rpc: Speedup getrawmempool when verbose=true (João Barbosa)
Pull request description:
Instead of calling `pushKV(hash, info)`, which incurs in duplicate key checks, call `__pushKV` which (currently) doesn't.
Improves RPC `getrawmempool` and REST `/rest/mempool/contents.json`.
Fixes #14765.
ACKs for commit 2d5cf4:
Tree-SHA512: c3e91371bb41f39e79dcef820815e1dc27fb689ca3c4bf3a00467d2215b3baecd44d9792f7a481577a5b7ae1fc6cbaa07b1cd62123b845082eba65b35c2b3ca5
Diffstat (limited to 'src/rpc/blockchain.cpp')
| -rw-r--r-- | src/rpc/blockchain.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index b8ef75866..56018caf2 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -486,7 +486,10 @@ UniValue MempoolToJSON(const CTxMemPool& pool, bool verbose) const uint256& hash = e.GetTx().GetHash(); UniValue info(UniValue::VOBJ); entryToJSON(pool, info, e); - o.pushKV(hash.ToString(), info); + // Mempool has unique entries so there is no advantage in using + // UniValue::pushKV, which checks if the key already exists in O(N). + // UniValue::__pushKV is used instead which currently is O(1). + o.__pushKV(hash.ToString(), info); } return o; } else { |