FlowStat: Replace btree_map with flat map which is inlined in small case

Inline storage for size <= 2
Size = 1 is ~90%
Size = 2 is ~9%
Size >=3 is ~1% and gets a separate allocation
This commit is contained in:
Jonathan G Rennison
2019-09-30 10:26:07 +01:00
parent 90550d9642
commit 0246d59c8d
8 changed files with 275 additions and 161 deletions

View File

@@ -155,8 +155,8 @@ void LinkGraphJob::FinaliseJob()
FlowStat shares(INVALID_STATION, INVALID_STATION, 1);
it->SwapShares(shares);
it = ge.flows.erase(it);
for (FlowStat::SharesMap::const_iterator shares_it(shares.GetShares()->begin());
shares_it != shares.GetShares()->end(); ++shares_it) {
for (FlowStat::const_iterator shares_it(shares.begin());
shares_it != shares.end(); ++shares_it) {
RerouteCargo(st, this->Cargo(), shares_it->second, st->index);
}
}