mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 15:11:38 +00:00
net: reduce ASMap lookup and address grouping costs #36994
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36994
Loading…
Reference in a new issue
No description provided.
Delete branch "l0rinc/asmap-performance"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem: Addrman groups peer addresses by network prefix or (when ASMap finds a match) by autonomous system.
Without ASMap, grouping classifies the address twice.
With ASMap, an IP lookup allocates a temporary key and the decoder calculates a shift distance for each mantissa bit.
Building the group can also take several allocations for just a few bytes.
Fix: When ASMap is disabled, skip the extra address classification in
GetMappedAS.Build ASMap lookup keys on the stack and decode integers by shifting each bit into the mantissa.
Reserve space for the address group before appending its bytes.
Time to group one IPv4 address: (Raspberry Pi 5, ns per call, lower is better)
Across the full series,
AddrManAddis 19.2% faster (59.1 to 49.6 ms).The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.
Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
Review failed because required verification did not complete.
Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive linked from the Review report for their assessments.
Review coverage was incomplete.
Reviewed:
4131eaa53f53· Review report · Previous reportspermalink
@fjahr / @hodlinator, you may be interested in this since it optimizes the byte-based ASMap decoder.
It also removes redundant address classification in the
GetMappedAS/GetGrouppath, avoids the temporary lookup allocation, and reserves the small group vector. The full series madeAddrManAdd19.2% faster on a Rpi5 (and I'd argue the code is also simpler).