16#include <benchmark/benchmark.h>
17#include <boost/format.hpp>
26static void BM_HashedNameLookup(benchmark::State& state)
28 for (
auto _ :
state) {
30 std::vector<HistogramSpec> histSpecs;
31 for (
auto i = 0;
i <
state.range(0); ++
i) {
32 histSpecs.push_back({fmt::format(
"histo{}",
i + 1).c_str(), fmt::format(
"Histo {}",
i + 1).c_str(), {HistType::kTH1F, {{100, 0, 1}}}});
38 auto x = registry.get<TH1>(
HIST(
"histo4"));
39 benchmark::DoNotOptimize(
x);
41 state.counters[
"Average lookup distance"] = ((double)registry.lookup / (
double)(
state.range(0)));
46static void BM_StandardNameLookup(benchmark::State& state)
48 for (
auto _ :
state) {
52 for (
auto i = 1;
i <=
state.range(0); ++
i) {
53 list.Add(
new TH1F((boost::format(
"histo%1%") %
i).
str().c_str(), (boost::format(
"Histo %1%") %
i).
str().c_str(), 100, 0, 1));
58 auto x =
list.FindObject(
"histo4");
59 benchmark::DoNotOptimize(
x);
63BENCHMARK(BM_HashedNameLookup)->Arg(4)->Arg(8)->Arg(16)->Arg(64)->Arg(128)->Arg(256)->Arg(512);
64BENCHMARK(BM_StandardNameLookup)->Arg(4)->Arg(8)->Arg(16)->Arg(64)->Arg(128)->Arg(256)->Arg(512);
const int nLookups
Number of lookups to perform.
BENCHMARK(BM_HashedNameLookup) -> Arg(4) ->Arg(8) ->Arg(16) ->Arg(64) ->Arg(128) ->Arg(256) ->Arg(512)
bool list(IEventListener &reporter, Config const &config)
Defining ITS Vertex explicitly as messageable.