32 #include <benchmark/benchmark.h>
33 #include "DGtal/base/Common.h"
35 #include "DGtal/base/Common.h"
36 #include "DGtal/kernel/SpaceND.h"
37 #include "DGtal/kernel/domains/HyperRectDomain.h"
38 #include "DGtal/images/ImageSelector.h"
40 #include "DGtal/helpers/StdDefs.h"
47 using namespace DGtal;
57 while (state.KeepRunning())
61 typename Q::Point().diagonal(state.range(0)));
70 template<
typename Po
int>
74 for (
unsigned int i = 0; i < size; ++i)
76 for(
unsigned int j=0; j < Point::dimension; j++)
77 p[j] = rand() % maxWidth;
87 std::set<typename Q::Point> data = ConstructRandomSet<typename Q::Point>(state.range(0),state.range(0));
90 while (state.KeepRunning())
94 typename Q::Point().diagonal(state.range(0)));
96 for(
typename std::set<typename Q::Point>::const_iterator it = data.begin(), itend=data.end();
100 image.setValue( *it , 42);
107 state.SetItemsProcessed(cpt);
116 std::set<typename Q::Point> data = ConstructRandomSet<typename Q::Point>(state.range(0),state.range(0));
118 while (state.KeepRunning())
122 typename Q::Point().diagonal(state.range(0)));
124 for(
typename std::set<typename Q::Point>::const_iterator it = data.begin(), itend=data.end();
126 image.setValue( *it , 42);
127 state.ResumeTiming();
130 benchmark::DoNotOptimize(sum += *it);
132 std::stringstream ss;
134 state.SetLabel(ss.str());
142 std::set<typename Q::Point> data = ConstructRandomSet<typename Q::Point>(state.range(0),state.range(0));
144 while (state.KeepRunning())
148 typename Q::Point().diagonal(state.range(0)));
150 for(
typename std::set<typename Q::Point>::const_iterator it = data.begin(), itend=data.end();
152 image.setValue( *it , 42);
153 state.ResumeTiming();
156 benchmark::DoNotOptimize( sum ++ );
158 std::stringstream ss;
160 state.SetLabel(ss.str());
171 int main(
int argc,
char **argv )
173 benchmark::Initialize(&argc, argv);
175 benchmark::RunSpecifiedBenchmarks();
int main(int argc, char **argv)
static void BM_SetValue(benchmark::State &state)
static void BM_Constructor(benchmark::State &state)
BENCHMARK_TEMPLATE(BM_Constructor, ImageVector2) -> Range(1<< 3, 1<< 10)
std::set< Point > ConstructRandomSet(unsigned int size, unsigned int maxWidth)
DGtal::ImageContainerBySTLVector< Z2i::Domain, DGtal::int32_t > ImageVector2
DGtal::experimental::ImageContainerByHashTree< Z2i::Domain, DGtal::int32_t > ImageHash2
DGtal::ImageContainerBySTLMap< Z2i::Domain, DGtal::int32_t > ImageMap2
static void BM_RangeScan(benchmark::State &state)
static void BM_DomainScan(benchmark::State &state)
Model of CImageContainer implementing the association key<->Value using a hash tree....
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::int64_t int64_t
signed 94-bit integer.
HyperRectDomain< Space > Domain