9 #error "Do not compile directly." 12 #include <type_traits> 14 #define ASSEMBLE_(POSTFIX, PREFIX) PREFIX ## POSTFIX 15 #define ASSEMBLE(POSTFIX, PREFIX) ASSEMBLE_(POSTFIX, PREFIX) 16 #define MYBENCHMARK(NAME) BENCHMARK(NAME) 17 #define MYBENCHMARK_TEMPLATE(NAME, TYPE) BENCHMARK_TEMPLATE(NAME, TYPE) 21 typename std::enable_if<Vec::size_ == 3, Vec>::type
23 return Vec(1.1, 1.2, 1.3);
28 typename std::enable_if<Vec::size_ == 4, Vec>::type
30 return Vec(1.1, 1.2, 1.3, 1.4);
34 static void ASSEMBLE(BMPOSTFIX, Vec_add_compare)(benchmark::State& state) {
37 while (state.KeepRunning()) {
47 dummy = v1.norm() + v2.norm();
48 static_cast<void>(dummy);
51 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_add_compare),
OpenMesh::Vec3d);
52 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_add_compare),
OpenMesh::Vec3f);
53 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_add_compare),
OpenMesh::Vec4d);
54 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_add_compare),
OpenMesh::Vec4f);
57 static void ASSEMBLE(BMPOSTFIX, Vec_cross_product)(benchmark::State& state) {
60 while (state.KeepRunning()) {
67 dummy = v1.norm() + v2.norm();
68 static_cast<void>(dummy);
71 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_cross_product),
OpenMesh::Vec3d);
72 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_cross_product),
OpenMesh::Vec3f);
75 static void ASSEMBLE(BMPOSTFIX, Vec_scalar_product)(benchmark::State& state) {
79 while (state.KeepRunning()) {
87 static_cast<void>(dummy);
90 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_scalar_product),
OpenMesh::Vec3d);
91 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_scalar_product),
OpenMesh::Vec3f);
92 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_scalar_product),
OpenMesh::Vec4d);
93 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_scalar_product),
OpenMesh::Vec4f);
96 static void ASSEMBLE(BMPOSTFIX, Vec_norm)(benchmark::State& state) {
99 while (state.KeepRunning()) {
100 v1 += testVec<Vec>();
106 static_cast<void>(dummy);
115 static void ASSEMBLE(BMPOSTFIX, Vec_times_scalar)(benchmark::State& state) {
117 while (state.KeepRunning()) {
118 v1 += testVec<Vec>();
119 v1 *=
static_cast<decltype(v1.norm())
>(1.0)/v1[0];
125 static_cast<void>(dummy);
128 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_times_scalar),
OpenMesh::Vec3d);
129 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_times_scalar),
OpenMesh::Vec3f);
130 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_times_scalar),
OpenMesh::Vec4d);
131 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_times_scalar),
OpenMesh::Vec4f);
133 #include "VectorT_dummy_data.hpp" 136 static void ASSEMBLE(BMPOSTFIX, Vec_add_in_place)(benchmark::State& state) {
137 auto v = make_dummy_vector<Vec>();
138 while (state.KeepRunning()) {
142 static double dummy = observe_dummy_vector(v);
143 static_cast<void>(dummy);
147 static void ASSEMBLE(BMPOSTFIX, Vec_add_temporary)(benchmark::State& state) {
148 auto v = make_dummy_vector<Vec>();
149 while (state.KeepRunning()) {
153 static double dummy = observe_dummy_vector(v);
154 static_cast<void>(dummy);
160 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_add_in_place), Vec3VAd);
161 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_add_temporary), Vec3VAd);
162 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_add_in_place), Vec3Cd);
163 MYBENCHMARK_TEMPLATE (ASSEMBLE(BMPOSTFIX, Vec_add_temporary), Vec3Cd);