mirror of
https://github.com/google/benchmark.git
synced 2024-12-28 05:20:14 +08:00
Small optimization to counter map management (#1382)
* Small optimization to counter map management Avoids an unnecessary lookup. * formatting
This commit is contained in:
parent
3eac3b60d2
commit
74ae567294
@ -118,11 +118,13 @@ std::vector<BenchmarkReporter::Run> ComputeStats(
|
|||||||
for (auto const& cnt : r.counters) {
|
for (auto const& cnt : r.counters) {
|
||||||
auto it = counter_stats.find(cnt.first);
|
auto it = counter_stats.find(cnt.first);
|
||||||
if (it == counter_stats.end()) {
|
if (it == counter_stats.end()) {
|
||||||
counter_stats.insert({cnt.first, {cnt.second, std::vector<double>{}}});
|
it = counter_stats
|
||||||
it = counter_stats.find(cnt.first);
|
.emplace(cnt.first,
|
||||||
|
CounterStat{cnt.second, std::vector<double>{}})
|
||||||
|
.first;
|
||||||
it->second.s.reserve(reports.size());
|
it->second.s.reserve(reports.size());
|
||||||
} else {
|
} else {
|
||||||
BM_CHECK_EQ(counter_stats[cnt.first].c.flags, cnt.second.flags);
|
BM_CHECK_EQ(it->second.c.flags, cnt.second.flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user