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.
This patch lowers the execution times of CAddrMan
’s methods as follows
(as per src/bench/addrman.cpp
):
0AddrMan::Add(): -3.5%
1AddrMan::GetAddr(): -76%
2AddrMan::Good(): -0.38%
3AddrMan::Select(): -45%