27 #include <type_traits> 31 long createNewII(
int count)
34 for (
int i = 0; i < count; ++i) {
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) 53 long createOldII(
int count)
57 for (
int i = 0; i < count; ++i) {
64 long fillNewII(
int count)
67 for (
int i = 0; i < count; ++i)
68 hist.
Fill({0.611, 0.611});
69 return hist.GetNDim();
72 long fillOldII(
int count)
75 for (
int i = 0; i < count; ++i)
76 hist.Fill(0.611, 0.611);
77 return (
long)hist.GetEntries();
80 long fillNII(
int count)
83 std::vector<Experimental::Hist::TCoordArray<2>>
v(count);
84 for (
int i = 0; i < count; ++i)
85 v[i] = {0.611, 0.611};
87 return hist.GetNDim();
90 long fillBufferedOldII(
int count)
94 for (
int i = 0; i < count; ++i)
95 hist.Fill(0.611, 0.611);
96 return (
long)hist.GetEntries();
99 long fillBufferedNewII(
int count)
103 for (
int i = 0; i < count; ++i)
104 filler.Fill({0.611, 0.611});
105 return hist.GetNDim();
110 long createNewEE(
int count)
113 for (
int i = 0; i < count; ++i) {
120 long createOldEE(
int count)
123 for (
int i = 0; i < count; ++i) {
124 TH2D hist(
"a",
"a hist", 100, 0., 1., 5, 0., 10.);
130 long fillNewEE(
int count)
133 for (
int i = 0; i < count; ++i)
134 hist.
Fill({0.611, 0.611});
135 return hist.GetNDim();
138 long 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();
146 long fillNEE(
int count)
149 std::vector<Experimental::Hist::TCoordArray<2>>
v(count);
150 for (
int i = 0; i < count; ++i)
151 v[i] = {0.611, 0.611};
153 return hist.GetNDim();
156 long 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();
165 long fillBufferedNewEE(
int count)
169 for (
int i = 0; i < count; ++i)
170 filler.Fill({0.611, 0.611});
171 return hist.GetNDim();
174 using timefunc_t = std::add_pointer_t<long(int)>;
176 void 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";
187 void 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]");
Namespace for new ROOT classes and functions.
Histogram class for histograms with DIMENSIONS dimensions, where each bin count is stored by a value ...
static Int_t GetDefaultBufferSize()
Static function return the default buffer size for automatic histograms the parameter fgBufferSize ma...
void Fill(const CoordArray_t &x, Weight_t weight=(Weight_t) 1) noexcept
Add weight to the bin containing coordinate x.
2-D histogram with a double per channel (see TH1 documentation)}