You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: use unordered_set / unordered_map where order isn't relevant
Did a few quickbench to ensure there isn't some advantage to using the "worse" data structure at small sizes.
set: https://quick-bench.com/q/ApPAGguzG2F9AnqM2GkgDAXCzX4
map: https://quick-bench.com/q/PXDdF0HVGpiSmC9Hh5FUSTp0uJU
Using unordered_map did show a tiny insertion regression for ~expected sizes on masternodes, but it appears that only 1 access will compensate for that overhead, and each su,
some perf results I have are here, show that this std::set usage is causing an imo unacceptably high cpu usage.
```
- 9.18% 0.00% d-mncon dashd [.] CConnman::ThreadOpenMasternodeConnections(CDeterministicMNManager&, CMasternodeMetaMan&, CMasternodeSync&)::{lambda()#▒
- CConnman::ThreadOpenMasternodeConnections(CDeterministicMNManager&, CMasternodeMetaMan&, CMasternodeSync&)::{lambda()#1}::operator()() const ▒
+ 6.16% CConnman::IsMasternodeOrDisconnectRequested(CService const&) ▒
- 2.66% std::set<CService, std::less<CService>, std::allocator<CService> >::count(CService const&) const ▒
- std::_Rb_tree<CService, CService, std::_Identity<CService>, std::less<CService>, std::allocator<CService> >::find(CService const&) const ▒
- 2.02% std::_Rb_tree<CService, CService, std::_Identity<CService>, std::less<CService>, std::allocator<CService> >::_M_lower_bound(std::_Rb_tree_node<CService> const▒
+ 1.99% std::less<CService>::operator()(CService const&, CService const&) const ▒
+ 0.62% std::less<CService>::operator()(CService const&, CService const&) const
```
0 commit comments