ROOT
Version v6.32
master
v6.34
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
Reference Guide
▼
ROOT
ROOT Reference Documentation
Tutorials
►
Functional Parts
►
Namespaces
►
All Classes
▼
Files
▼
File List
▼
bindings
▼
pyroot
▼
cppyy
▼
cppyy
▼
bench
►
functioncalls.cxx
►
functioncalls.h
►
functioncalls_main.cxx
►
py11_functioncalls.cxx
►
runvector.cxx
►
runvector.h
►
runvector_main.cxx
►
cppyy-backend
►
CPyCppyy
►
pythonizations
►
r
►
tpython
►
core
►
documentation
►
geom
►
graf2d
►
graf3d
►
gui
►
hist
►
html
►
io
►
main
►
math
►
montecarlo
►
net
►
proof
►
roofit
►
sql
►
tmva
►
tree
►
tutorials
►
v6-32-00-patches
►
File Members
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
runvector_main.cxx
Go to the documentation of this file.
1
#include <iostream>
2
#include <iomanip>
3
#include <vector>
4
#include <time.h>
5
#include <unistd.h>
6
7
#include "
runvector.h
"
8
9
10
static
const
int
N
= 100000000;
// 10^8, i.e. per call is in 10 nanoseconds
11
12
int
cpp_loop_offset
() {
13
int
i = 0;
14
for
( ; i <
N
; ++i)
15
;
16
return
i;
17
}
18
19
20
//- group: stl-vector --------------------------------------------------------
21
void
cpp_runvector
() {
22
for
(
auto
i:
global_vector
)
23
global_effect
+= i;
24
}
25
26
27
//----------------------------------------------------------------------------
28
void
run_bench
(
void
(*
cpp_bench
)(),
const
char
* label) {
29
clock_t
t1
=
clock
();
30
cpp_loop_offset
();
31
clock_t
t2
=
clock
();
32
cpp_bench
();
33
clock_t
t3
=
clock
();
34
35
std::cout << label <<
": "
<< std::setprecision(8)
36
<< 10.*((
t3
-
t2
) - (
t2
-
t1
))/((
double
)
CLOCKS_PER_SEC
) <<
" nanoseconds"
<< std::endl;
37
}
38
39
int
main
() {
40
run_bench
(
cpp_runvector
,
"cpp_runvector"
);
41
return
0;
42
}
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
global_vector
std::vector< int > global_vector
Definition
runvector.cxx:3
global_effect
double global_effect
Definition
runvector.cxx:4
runvector.h
cpp_loop_offset
int cpp_loop_offset()
Definition
runvector_main.cxx:12
run_bench
void run_bench(void(*cpp_bench)(), const char *label)
Definition
runvector_main.cxx:28
N
static const int N
Definition
runvector_main.cxx:10
cpp_runvector
void cpp_runvector()
Definition
runvector_main.cxx:21
main
int main()
Definition
runvector_main.cxx:39
t1
auto * t1
Definition
textangle.C:20
bindings
pyroot
cppyy
cppyy
bench
runvector_main.cxx
ROOT v6-32 - Reference Guide Generated on Wed Apr 2 2025 08:24:18 (GVA Time) using Doxygen 1.10.0