25 #include <type_traits>
29 long createNew(
int count)
32 for (
int i = 0; i < count; ++i) {
33 Experimental::RH2D hist({{{100, 0., 1.}, {{0., 1., 2., 3., 10.}}}});
39 long fillNew(
int count)
41 Experimental::RH2D hist({{{100, 0., 1.}, {{0., 1., 2., 3., 10.}}}});
42 for (
int i = 0; i < count; ++i)
43 hist.Fill({0.611, 0.611});
44 return hist.GetNDim();
49 Experimental::RH2D hist({{{100, 0., 1.}, {{0., 1., 2., 3., 10.}}}});
50 std::vector<Experimental::Hist::RCoordArray<2>> v(count);
51 for (
int i = 0; i < count; ++i)
52 v[i] = {0.611, 0.611};
54 return hist.GetNDim();
57 long fillBufferedNew(
int count)
59 Experimental::RH2D hist({{{100, 0., 1.}, {{0., 1., 2., 3., 10.}}}});
60 Experimental::RHistBufferedFill<Experimental::RH2D> filler(hist);
61 for (
int i = 0; i < count; ++i)
62 filler.Fill({0.611, 0.611});
63 return hist.GetNDim();
66 using timefunc_t = std::add_pointer_t<long(int)>;
68 void time1(timefunc_t run,
int count,
const std::string &name)
70 using namespace std::chrono;
71 auto start = high_resolution_clock::now();
73 auto end = high_resolution_clock::now();
74 duration<double> time_span = duration_cast<duration<double>>(end - start);
76 std::cout << count <<
" * " << name <<
": " << time_span.count() <<
"seconds \n";
79 void time(timefunc_t r7,
int count,
const std::string &name)
81 time1(r7, count, name +
" (ROOT7)");
86 time(createNew, 1000000,
"create 2D hists");
87 time(fillNew, 100000000,
"2D fills");
88 time(fillBufferedNew, 100000000,
"2D fills (buffered)");