diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-06-06 13:20:29 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-06-06 13:20:29 +0000 |
commit | e0dcde73991a13be48f2aed9829d5e744d7fe508 (patch) | |
tree | 24cdaeadd0b7c8ddd44c3d8c3040d7b328bf1c09 /bench | |
parent | f8db093daaf35bf6eaf32cff980701b3acd1d9a2 (diff) |
make concat_float distinguishable using -match
init our float/double arrays, so we get reliable timings (NaNs are slow)
git-svn-id: http://skia.googlecode.com/svn/trunk@1509 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench')
-rw-r--r-- | bench/MatrixBench.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/bench/MatrixBench.cpp b/bench/MatrixBench.cpp index 783bf51940..eb7d39f5db 100644 --- a/bench/MatrixBench.cpp +++ b/bench/MatrixBench.cpp @@ -83,12 +83,24 @@ private: typedef MatrixBench INHERITED; }; +// having unknown values in our arrays can throw off the timing a lot, perhaps +// handling NaN values is a lot slower. Anyway, this guy is just meant to put +// reasonable values in our arrays. +template <typename T> void init9(T array[9]) { + SkRandom rand; + for (int i = 0; i < 9; i++) { + array[i] = rand.nextSScalar1(); + } +} + // Test the performance of setConcat() non-perspective case: // using floating point precision only. class FloatConcatMatrixBench : public MatrixBench { public: - FloatConcatMatrixBench(void* param) - : INHERITED(param, "concat_float") { + FloatConcatMatrixBench(void* p) : INHERITED(p, "concat_floatfloat") { + init9(mya); + init9(myb); + init9(myr); } protected: static inline void muladdmul(float a, float b, float c, float d, @@ -126,8 +138,10 @@ static inline float SkDoubleToFloat(double x) { // intermediate results during computations. class FloatDoubleConcatMatrixBench : public MatrixBench { public: - FloatDoubleConcatMatrixBench(void* param) - : INHERITED(param, "concat_floatdouble") { + FloatDoubleConcatMatrixBench(void* p) : INHERITED(p, "concat_floatdouble") { + init9(mya); + init9(myb); + init9(myr); } protected: static inline void muladdmul(float a, float b, float c, float d, @@ -160,8 +174,10 @@ private: // using double precision only. class DoubleConcatMatrixBench : public MatrixBench { public: - DoubleConcatMatrixBench(void* param) - : INHERITED(param, "concat_double") { + DoubleConcatMatrixBench(void* p) : INHERITED(p, "concat_double") { + init9(mya); + init9(myb); + init9(myr); } protected: static inline void muladdmul(double a, double b, double c, double d, |