Page MenuHomePhabricator

Improve the performance of removeForBlock
ClosedPublic

Authored by Fabien on Mar 1 2023, 15:18.

Details

Reviewers
sdulfari
Group Reviewers
Restricted Project
Commits
rABCcb2bcb8b6c26: Improve the performance of removeForBlock
Summary

This is inspired by bchn#1188, though most of the changes are irrelevant for us due to being already fixed by code changes. Also our mutex requirement is much better so some optimization are simply not worth it either.

In the end only a couple optimizations remain, bot in removeForBlock:

  • The removeConflicts call can be skipped for txs coming from the mempool that are guaranteed to not have any conflict
  • The whole mempool cleanup is needless if the mempool is empty, which is especially useful during IBD. An extra comment is added here to explain why the rolling fee feature can be skipped with no change in behavior.
Test Plan
ninja all check-all

Run IBD.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
mempool_removeforblock_improvements
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22180
Build 43995: Build Diffbuild-diff · build-without-wallet · lint-circular-dependencies · build-clang-tidy · build-debug · build-clang
Build 43994: arc lint + arc unit

Event Timeline

Fabien requested review of this revision.Mar 1 2023, 15:18
sdulfari added a subscriber: sdulfari.
sdulfari added inline comments.
src/txmempool.cpp
593

Is checking mapDeltas actually necessary here?

This revision is now accepted and ready to land.Mar 1 2023, 23:50
src/txmempool.cpp
593

I'm not sure you can prioritize a tx which is not in the mempool, but the test is not expensive so we use belt and suspenders

This revision was automatically updated to reflect the committed changes.