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.
Differential D12252
addrman: improve performance by using more suitable containers Fabien on Oct 14 2022, 12:43. Authored by Tags None Subscribers None
Details
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. ninja all check-all Build and run the unit tests with DEBUG_ADDRMAN defined.
Diff Detail
|