31long createNewII(
int count)
34 for (
int i = 0; i < count; ++i) {
35 RH2D hist({{{{0., 0.1, 0.3, 1.}}, {{0., 1., 2., 3., 10.}}}});
42 static const int nBinsX = 4; \
43 double x[nBinsX] = {0., 0.1, 0.3, 1.}; \
44 static const int nBinsY = 5; \
45 double y[nBinsY] = {0., 1., 2., 3., 10.}
47#define DECLOLD TH2D hist("a", "a hist", nBinsX - 1, x, nBinsY - 1, y)
53long createOldII(
int count)
57 for (
int i = 0; i < count; ++i) {
64long fillNewII(
int count)
66 RH2D hist({{{{0., 0.1, 0.3, 1.}}, {{0., 1., 2., 3., 10.}}}});
67 for (
int i = 0; i < count; ++i)
68 hist.
Fill({0.611, 0.611});
69 return hist.GetNDim();
72long fillOldII(
int count)
75 for (
int i = 0; i < count; ++i)
76 hist.Fill(0.611, 0.611);
77 return (
long)hist.GetEntries();
80long fillNII(
int count)
82 RH2D hist({{{{0., 0.1, 0.3, 1.}}, {{0., 1., 2., 3., 10.}}}});
83 std::vector<Hist::RCoordArray<2>>
v(count);
84 for (
int i = 0; i < count; ++i)
85 v[i] = {0.611, 0.611};
87 return hist.GetNDim();
90long fillBufferedOldII(
int count)
94 for (
int i = 0; i < count; ++i)
95 hist.Fill(0.611, 0.611);
96 return (
long)hist.GetEntries();
99long fillBufferedNewII(
int count)
101 RH2D hist({{{{0., 0.1, 0.3, 1.}}, {{0., 1., 2., 3., 10.}}}});
103 for (
int i = 0; i < count; ++i)
104 filler.Fill({0.611, 0.611});
105 return hist.GetNDim();
110long createNewEE(
int count)
113 for (
int i = 0; i < count; ++i) {
114 RH2D hist({{{100, 0., 1.}, {5, 0., 10.}}});
120long createOldEE(
int count)
123 for (
int i = 0; i < count; ++i) {
124 TH2D hist(
"a",
"a hist", 100, 0., 1., 5, 0., 10.);
130long fillNewEE(
int count)
132 RH2D hist({{{100, 0., 1.}, {5, 0., 10.}}});
133 for (
int i = 0; i < count; ++i)
134 hist.
Fill({0.611, 0.611});
135 return hist.GetNDim();
138long fillOldEE(
int count)
140 TH2D hist(
"a",
"a hist", 100, 0., 1., 5, 0., 10.);
141 for (
int i = 0; i < count; ++i)
142 hist.Fill(0.611, 0.611);
143 return (
long)hist.GetEntries();
146long fillNEE(
int count)
148 RH2D hist({{{100, 0., 1.}, {5, 0., 10.}}});
149 std::vector<Hist::RCoordArray<2>>
v(count);
150 for (
int i = 0; i < count; ++i)
151 v[i] = {0.611, 0.611};
153 return hist.GetNDim();
156long fillBufferedOldEE(
int count)
158 TH2D hist(
"a",
"a hist", 100, 0., 1., 5, 0., 10.);
160 for (
int i = 0; i < count; ++i)
161 hist.Fill(0.611, 0.611);
162 return (
long)hist.GetEntries();
165long fillBufferedNewEE(
int count)
167 RH2D hist({{{100, 0., 1.}, {5, 0., 10.}}});
169 for (
int i = 0; i < count; ++i)
170 filler.Fill({0.611, 0.611});
171 return hist.GetNDim();
174using timefunc_t = std::add_pointer_t<long(
int)>;
176void time1(timefunc_t run,
int count,
const std::string &
name)
178 using namespace std::chrono;
179 auto start = high_resolution_clock::now();
181 auto end = high_resolution_clock::now();
182 duration<double> time_span = duration_cast<duration<double>>(end - start);
184 std::cout << count <<
" * " <<
name <<
": " << time_span.count() <<
"seconds \n";
187void time(timefunc_t r6, timefunc_t r7,
int count,
const std::string &
name)
189 time1(r6, count,
name +
" (ROOT6)");
190 time1(r7, count,
name +
" (ROOT7)");
195 int factor = 1000000;
197 time(createOldII, createNewII, factor,
"create 2D hists [II]");
198 time(createOldEE, createNewEE, factor,
"create 2D hists [EE]");
199 time(fillOldII, fillNewII, 100 * factor,
"2D fills [II]");
200 time(fillOldEE, fillNewEE, 100 * factor,
"2D fills [EE]");
201 time(fillBufferedOldII, fillBufferedNewII, 100 * factor,
"2D fills (buffered) [II]");
202 time(fillBufferedOldEE, fillBufferedNewEE, 100 * factor,
"2D fills (buffered) [EE]");
Histogram class for histograms with DIMENSIONS dimensions, where each bin count is stored by a value ...
void Fill(const CoordArray_t &x, Weight_t weight=(Weight_t) 1) noexcept
Add weight to the bin containing coordinate x.
static Int_t GetDefaultBufferSize()
Static function return the default buffer size for automatic histograms the parameter fgBufferSize ma...
2-D histogram with a double per channel (see TH1 documentation)}