HomePhabricator

mempool: Slight performance nit when erasing from setEntries

Description

mempool: Slight performance nit when erasing from setEntries

Summary:

When re-reading all of the mempool code in master I noticed that in 2 places, a working `setEntries` (which is an alias for a
`std::set<CTxMemPool::txiter>`) was being erased-from inefficiently.

In these two places we are grabbing the first `txiter` from the set then we are erasing it.  In the extant code, the `txiter` is being passed as a *key* to the set. Instead, we should be erasing using the slightly more efficient `std::set(std::set::iterator)` overload, which does not need to do any O(log N) lookups.

Port of bchn#1175.
Depends on D13171.

There is no change in behavior.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D13176

Details

Provenance
CCulianuAuthored on Apr 13 2021, 03:28
FabienCommitted on Feb 28 2023, 08:00
FabienPushed on Feb 28 2023, 08:00
Reviewer
Restricted Project
Differential Revision
D13176: mempool: Slight performance nit when erasing from setEntries
Parents
rABC07715ddb4d61: Disable the chained-tx limit after wellington
Branches
Unknown
Tags
Unknown