From 98798e904bd255de1d775f4f7b468614cc48eeb0 Mon Sep 17 00:00:00 2001 From: Jakob Schwendner Date: Sun, 16 Dec 2012 23:30:56 +0100 Subject: added benchmark for test vectorization in geometry package --- bench/benchGeometry.cpp | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 bench/benchGeometry.cpp (limited to 'bench/benchGeometry.cpp') diff --git a/bench/benchGeometry.cpp b/bench/benchGeometry.cpp new file mode 100644 index 000000000..270b67b65 --- /dev/null +++ b/bench/benchGeometry.cpp @@ -0,0 +1,84 @@ +#include +#include +#include +#include +using namespace Eigen; + +#ifndef REPEAT +#define REPEAT 1000000 +#endif + +enum func_opt +{ + TV, + TMATRIXV +}; + + +template +struct func; + +template +struct func +{ + static __attribute__ ((noinline)) res run( arg1& a1, arg2& a2 ) + { + asm (""); + return a1 * a2; + } +}; + +template +struct func +{ + static __attribute__ ((noinline)) res run( arg1& a1, arg2& a2 ) + { + asm (""); + return a1.matrix() * a2; + } +}; + + +template +struct test_transform +{ + static void run() + { + arg1 a1; + a1.setIdentity(); + arg2 a2; + a2.setIdentity(); + + BenchTimer timer; + timer.reset(); + for (int k=0; k<10; ++k) + { + timer.start(); + for (int k=0; k Trans;\ + typedef Matrix Vec;\ + typedef func Func;\ + test_transform< Func, Trans, Vec >::run();\ + } + +int main(int argc, char* argv[]) +{ + run_test(TV, float, Isometry, AutoAlign, 3); + run_test(TV, float, Isometry, DontAlign, 3); + run_test(TV, float, Isometry, AutoAlign, 4); + run_test(TV, float, Isometry, DontAlign, 4); + + run_test(TMATRIXV, float, Isometry, AutoAlign, 4); + run_test(TMATRIXV, float, Isometry, DontAlign, 4); +} -- cgit v1.2.3