DGtal 1.3.0
Loading...
Searching...
No Matches
Typedefs | Functions
benchmarkSetContainer.cpp File Reference
#include <iostream>
#include <benchmark/benchmark.h>
#include <unordered_set>
#include "DGtal/base/Common.h"
#include "DGtal/kernel/domains/CDomainArchetype.h"
#include "DGtal/kernel/sets/DigitalSetBySTLVector.h"
#include "DGtal/kernel/sets/DigitalSetBySTLSet.h"
#include "DGtal/kernel/sets/DigitalSetByAssociativeContainer.h"
#include "DGtal/kernel/sets/DigitalSetFromMap.h"
#include "DGtal/kernel/PointHashFunctions.h"
#include "DGtal/helpers/StdDefs.h"
#include <map>
#include <string>

Go to the source code of this file.

Typedefs

typedef DGtal::DigitalSetBySTLSet< Z2i::DomainFromSet
 
typedef DGtal::DigitalSetBySTLVector< Z2i::DomainFromVector
 
typedef DGtal::DigitalSetByAssociativeContainer< Z2i::Domain, std::unordered_set< Z2i::Point > > FromUnordered
 
typedef DGtal::DigitalSetBySTLSet< Z3i::DomainFromSet3
 
typedef DGtal::DigitalSetBySTLVector< Z3i::DomainFromVector3
 
typedef DGtal::DigitalSetByAssociativeContainer< Z3i::Domain, std::unordered_set< Z3i::Point > > FromUnordered3
 

Functions

template<typename Q >
static void BM_Constructor (benchmark::State &state)
 
 BENCHMARK_TEMPLATE (BM_Constructor, FromVector) -> Range(1<< 3, 1<< 8)
 
 BENCHMARK_TEMPLATE (BM_Constructor, FromSet) -> Range(1<< 3, 1<< 8)
 
 BENCHMARK_TEMPLATE (BM_Constructor, FromUnordered) -> Range(1<< 3, 1<< 8)
 
template<typename Q >
static void BM_insert (benchmark::State &state)
 
 BENCHMARK_TEMPLATE (BM_insert, FromVector)
 
 BENCHMARK_TEMPLATE (BM_insert, FromSet)
 
 BENCHMARK_TEMPLATE (BM_insert, FromUnordered)
 
template<typename Q >
static void BM_iterate (benchmark::State &state)
 
 BENCHMARK_TEMPLATE (BM_iterate, FromVector) -> Range(1<< 3, 1<< 10)
 
 BENCHMARK_TEMPLATE (BM_iterate, FromSet) -> Range(1<< 3, 1<< 10)
 
 BENCHMARK_TEMPLATE (BM_iterate, FromUnordered) -> Range(1<< 3, 1<< 10)
 
int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
David Coeurjolly (david.nosp@m..coe.nosp@m.urjol.nosp@m.ly@l.nosp@m.iris..nosp@m.cnrs.nosp@m..fr ) Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2015/14/06

Functions for benchmarking digitalset containers.

This file is part of the DGtal library.

Definition in file benchmarkSetContainer.cpp.

Typedef Documentation

◆ FromSet

Definition at line 54 of file benchmarkSetContainer.cpp.

◆ FromSet3

Definition at line 58 of file benchmarkSetContainer.cpp.

◆ FromUnordered

Definition at line 56 of file benchmarkSetContainer.cpp.

◆ FromUnordered3

Definition at line 60 of file benchmarkSetContainer.cpp.

◆ FromVector

Definition at line 55 of file benchmarkSetContainer.cpp.

◆ FromVector3

Definition at line 59 of file benchmarkSetContainer.cpp.

Function Documentation

◆ BENCHMARK_TEMPLATE() [1/9]

BENCHMARK_TEMPLATE ( BM_Constructor  ,
FromSet   
) -> Range(1<< 3, 1<< 8)

◆ BENCHMARK_TEMPLATE() [2/9]

BENCHMARK_TEMPLATE ( BM_Constructor  ,
FromUnordered   
) -> Range(1<< 3, 1<< 8)

◆ BENCHMARK_TEMPLATE() [3/9]

BENCHMARK_TEMPLATE ( BM_Constructor  ,
FromVector   
) -> Range(1<< 3, 1<< 8)

◆ BENCHMARK_TEMPLATE() [4/9]

BENCHMARK_TEMPLATE ( BM_insert  ,
FromSet   
)

◆ BENCHMARK_TEMPLATE() [5/9]

BENCHMARK_TEMPLATE ( BM_insert  ,
FromUnordered   
)

◆ BENCHMARK_TEMPLATE() [6/9]

BENCHMARK_TEMPLATE ( BM_insert  ,
FromVector   
)

◆ BENCHMARK_TEMPLATE() [7/9]

BENCHMARK_TEMPLATE ( BM_iterate  ,
FromSet   
) -> Range(1<< 3, 1<< 10)

◆ BENCHMARK_TEMPLATE() [8/9]

BENCHMARK_TEMPLATE ( BM_iterate  ,
FromUnordered   
) -> Range(1<< 3, 1<< 10)

◆ BENCHMARK_TEMPLATE() [9/9]

BENCHMARK_TEMPLATE ( BM_iterate  ,
FromVector   
) -> Range(1<< 3, 1<< 10)

◆ BM_Constructor()

template<typename Q >
static void BM_Constructor ( benchmark::State &  state)
static

Definition at line 63 of file benchmarkSetContainer.cpp.

64{
65 while (state.KeepRunning())
66 {
67 state.PauseTiming();
68 typename Q::Domain dom(typename Q::Point().diagonal(0),
69 typename Q::Point().diagonal((typename Q::Domain::Space::Integer)state.range(0)));
70 state.ResumeTiming();
71 Q image( dom );
72 }
73}
DGtal::LinearOperator< Calculus, dim, duality, dim, duality > diagonal(const DGtal::KForm< Calculus, dim, duality > &kform)
Definition: DECHelpers.h:60

◆ BM_insert()

template<typename Q >
static void BM_insert ( benchmark::State &  state)
static

Definition at line 83 of file benchmarkSetContainer.cpp.

84{
85 Q myset(typename Q::Domain( Q::Point::diagonal(0), Q::Point::diagonal(2048) ));
86 while (state.KeepRunning())
87 {
88 state.PauseTiming();
89 typename Q::Point p;
90 for(unsigned int j=0; j < Q::Point::dimension; j++)
91 p[j] = rand() % 2048;
92 state.ResumeTiming();
93
94 myset.insert( p );
95 }
96}

◆ BM_iterate()

template<typename Q >
static void BM_iterate ( benchmark::State &  state)
static

Definition at line 107 of file benchmarkSetContainer.cpp.

108{
109 Q myset(typename Q::Domain( Q::Point::diagonal(0), Q::Point::diagonal(2048) ));
110 for(unsigned int i= 0; i < state.range(0); ++i)
111 {
112 typename Q::Point p;
113 for(unsigned int j=0; j < Q::Point::dimension; j++)
114 p[j] = rand() % 2048;
115 myset.insert( p );
116 }
117 while (state.KeepRunning())
118 {
119 for(typename Q::ConstIterator it= myset.begin(), itend=myset.end(); it != itend;
120 ++it)
121 benchmark::DoNotOptimize(it);
122 }
123}

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 135 of file benchmarkSetContainer.cpp.

136{
137 benchmark::Initialize(&argc, argv);
138
139 benchmark::RunSpecifiedBenchmarks();
140 return 0;
141}