HomePhabricator

addrman: improve performance by using more suitable containers

Description

addrman: improve performance by using more suitable containers

Summary:

CAddrMan uses std::map internally even though it does not require
that the map's elements are sorted. std::map's access time is
O(log(map size)). std::unordered_map is more suitable as it has a
O(1) access time.

Backport of core#18722.

Test Plan:

ninja all check-all

Build and run the unit tests with DEBUG_ADDRMAN defined.

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

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

Details

Provenance
Vasil Dimov <vd@FreeBSD.org>Authored on Apr 20 2020, 15:11
FabienCommitted on Oct 14 2022, 18:49
FabienPushed on Oct 14 2022, 18:49
Reviewer
Restricted Project
Differential Revision
D12252: addrman: improve performance by using more suitable containers
Parents
rABCf67bd495370e: [net] remove fUpdateConnectionTime from FinalizeNode
Branches
Unknown
Tags
Unknown