30long createNewII(
int count)
33 for (
int i = 0; i < count; ++i) {
34 RH2D hist({{{{0., 0.1, 0.3, 1.}}, {{0., 1., 2., 3., 10.}}}});
41 static const int nBinsX = 4; \
42 double x[nBinsX] = {0., 0.1, 0.3, 1.}; \
43 static const int nBinsY = 5; \
44 double y[nBinsY] = {0., 1., 2., 3., 10.}
46#define DECLOLD TH2D hist("a", "a hist", nBinsX - 1, x, nBinsY - 1, y)
52long createOldII(
int count)
56 for (
int i = 0; i < count; ++i) {
63long fillNewII(
int count)
65 RH2D hist({{{{0., 0.1, 0.3, 1.}}, {{0., 1., 2., 3., 10.}}}});
66 for (
int i = 0; i < count; ++i)
67 hist.
Fill({0.611, 0.611});
68 return hist.GetNDim();
71long fillOldII(
int count)
74 for (
int i = 0; i < count; ++i)
75 hist.Fill(0.611, 0.611);
76 return (
long)hist.GetEntries();
79long fillNII(
int count)
81 RH2D hist({{{{0., 0.1, 0.3, 1.}}, {{0., 1., 2., 3., 10.}}}});
82 std::vector<Hist::RCoordArray<2>>
v(count);
83 for (
int i = 0; i < count; ++i)
84 v[i] = {0.611, 0.611};
86 return hist.GetNDim();
89long fillBufferedOldII(
int count)
93 for (
int i = 0; i < count; ++i)
94 hist.Fill(0.611, 0.611);
95 return (
long)hist.GetEntries();
98long fillBufferedNewII(
int count)
100 RH2D hist({{{{0., 0.1, 0.3, 1.}}, {{0., 1., 2., 3., 10.}}}});
102 for (
int i = 0; i < count; ++i)
103 filler.Fill({0.611, 0.611});
104 return hist.GetNDim();
109long createNewEE(
int count)
112 for (
int i = 0; i < count; ++i) {
113 RH2D hist({{{100, 0., 1.}, {5, 0., 10.}}});
119long createOldEE(
int count)
122 for (
int i = 0; i < count; ++i) {
123 TH2D hist(
"a",
"a hist", 100, 0., 1., 5, 0., 10.);
129long fillNewEE(
int count)
131 RH2D hist({{{100, 0., 1.}, {5, 0., 10.}}});
132 for (
int i = 0; i < count; ++i)
133 hist.
Fill({0.611, 0.611});
134 return hist.GetNDim();
137long fillOldEE(
int count)
139 TH2D hist(
"a",
"a hist", 100, 0., 1., 5, 0., 10.);
140 for (
int i = 0; i < count; ++i)
141 hist.Fill(0.611, 0.611);
142 return (
long)hist.GetEntries();
145long fillNEE(
int count)
147 RH2D hist({{{100, 0., 1.}, {5, 0., 10.}}});
148 std::vector<Hist::RCoordArray<2>>
v(count);
149 for (
int i = 0; i < count; ++i)
150 v[i] = {0.611, 0.611};
152 return hist.GetNDim();
155long fillBufferedOldEE(
int count)
157 TH2D hist(
"a",
"a hist", 100, 0., 1., 5, 0., 10.);
159 for (
int i = 0; i < count; ++i)
160 hist.Fill(0.611, 0.611);
161 return (
long)hist.GetEntries();
164long fillBufferedNewEE(
int count)
166 RH2D hist({{{100, 0., 1.}, {5, 0., 10.}}});
168 for (
int i = 0; i < count; ++i)
169 filler.Fill({0.611, 0.611});
170 return hist.GetNDim();
173using timefunc_t = std::add_pointer_t<long(
int)>;
175void time1(timefunc_t run,
int count,
const std::string &
name)
177 using namespace std::chrono;
178 auto start = high_resolution_clock::now();
180 auto end = high_resolution_clock::now();
181 duration<double> time_span = duration_cast<duration<double>>(
end -
start);
183 std::cout << count <<
" * " <<
name <<
": " << time_span.count() <<
"seconds \n";
186void time(timefunc_t r6, timefunc_t r7,
int count,
const std::string &
name)
188 time1(r6, count,
name +
" (ROOT6)");
189 time1(r7, count,
name +
" (ROOT7)");
194 int factor = 1000000;
196 time(createOldII, createNewII, factor,
"create 2D hists [II]");
197 time(createOldEE, createNewEE, factor,
"create 2D hists [EE]");
198 time(fillOldII, fillNewII, 100 * factor,
"2D fills [II]");
199 time(fillOldEE, fillNewEE, 100 * factor,
"2D fills [EE]");
200 time(fillBufferedOldII, fillBufferedNewII, 100 * factor,
"2D fills (buffered) [II]");
201 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)