Page MenuHomePhabricator

addrman: improve performance by using more suitable containers
ClosedPublic

Authored by Fabien on Oct 14 2022, 12:43.

Details

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.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable