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
This commit is contained in:
reed@google.com 2011-06-06 13:20:29 +00:00
parent f8db093daa
commit e0dcde7399

View File

@ -83,12 +83,24 @@ private:
typedef MatrixBench INHERITED; 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: // Test the performance of setConcat() non-perspective case:
// using floating point precision only. // using floating point precision only.
class FloatConcatMatrixBench : public MatrixBench { class FloatConcatMatrixBench : public MatrixBench {
public: public:
FloatConcatMatrixBench(void* param) FloatConcatMatrixBench(void* p) : INHERITED(p, "concat_floatfloat") {
: INHERITED(param, "concat_float") { init9(mya);
init9(myb);
init9(myr);
} }
protected: protected:
static inline void muladdmul(float a, float b, float c, float d, 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. // intermediate results during computations.
class FloatDoubleConcatMatrixBench : public MatrixBench { class FloatDoubleConcatMatrixBench : public MatrixBench {
public: public:
FloatDoubleConcatMatrixBench(void* param) FloatDoubleConcatMatrixBench(void* p) : INHERITED(p, "concat_floatdouble") {
: INHERITED(param, "concat_floatdouble") { init9(mya);
init9(myb);
init9(myr);
} }
protected: protected:
static inline void muladdmul(float a, float b, float c, float d, static inline void muladdmul(float a, float b, float c, float d,
@ -160,8 +174,10 @@ private:
// using double precision only. // using double precision only.
class DoubleConcatMatrixBench : public MatrixBench { class DoubleConcatMatrixBench : public MatrixBench {
public: public:
DoubleConcatMatrixBench(void* param) DoubleConcatMatrixBench(void* p) : INHERITED(p, "concat_double") {
: INHERITED(param, "concat_double") { init9(mya);
init9(myb);
init9(myr);
} }
protected: protected:
static inline void muladdmul(double a, double b, double c, double d, static inline void muladdmul(double a, double b, double c, double d,