mirror of
https://github.com/google/benchmark.git
synced 2024-12-27 13:00:36 +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) {
|
||||
auto it = counter_stats.find(cnt.first);
|
||||
if (it == counter_stats.end()) {
|
||||
counter_stats.insert({cnt.first, {cnt.second, std::vector<double>{}}});
|
||||
it = counter_stats.find(cnt.first);
|
||||
it = counter_stats
|
||||
.emplace(cnt.first,
|
||||
CounterStat{cnt.second, std::vector<double>{}})
|
||||
.first;
|
||||
it->second.s.reserve(reports.size());
|
||||
} 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