| OLD | NEW |
| 1 #include "SkBenchmark.h" | 1 #include "SkBenchmark.h" |
| 2 #include "SkColorPriv.h" | 2 #include "SkColorPriv.h" |
| 3 #include "SkMatrix.h" | 3 #include "SkMatrix.h" |
| 4 #include "SkRandom.h" | 4 #include "SkRandom.h" |
| 5 #include "SkString.h" | 5 #include "SkString.h" |
| 6 #include "SkPaint.h" | 6 #include "SkPaint.h" |
| 7 | 7 |
| 8 static float sk_fsel(float pred, float result_ge, float result_lt) { | 8 static float sk_fsel(float pred, float result_ge, float result_lt) { |
| 9 return pred >= 0 ? result_ge : result_lt; | 9 return pred >= 0 ? result_ge : result_lt; |
| 10 } | 10 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 const float* SK_RESTRICT src, | 85 const float* SK_RESTRICT src, |
| 86 int count) { | 86 int count) { |
| 87 for (int i = 0; i < count; ++i) { | 87 for (int i = 0; i < count; ++i) { |
| 88 dst[i] = src[i] + 1; | 88 dst[i] = src[i] + 1; |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 private: | 91 private: |
| 92 typedef MathBench INHERITED; | 92 typedef MathBench INHERITED; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 class SkRSqrtMathBench : public MathBench { |
| 96 public: |
| 97 SkRSqrtMathBench() : INHERITED("sk_float_rsqrt") {} |
| 98 protected: |
| 99 virtual void performTest(float* SK_RESTRICT dst, |
| 100 const float* SK_RESTRICT src, |
| 101 int count) { |
| 102 for (int i = 0; i < count; ++i) { |
| 103 dst[i] = sk_float_rsqrt(src[i]); |
| 104 } |
| 105 } |
| 106 private: |
| 107 typedef MathBench INHERITED; |
| 108 }; |
| 109 |
| 110 |
| 95 class SlowISqrtMathBench : public MathBench { | 111 class SlowISqrtMathBench : public MathBench { |
| 96 public: | 112 public: |
| 97 SlowISqrtMathBench() : INHERITED("slowIsqrt") {} | 113 SlowISqrtMathBench() : INHERITED("slowIsqrt") {} |
| 98 protected: | 114 protected: |
| 99 virtual void performTest(float* SK_RESTRICT dst, | 115 virtual void performTest(float* SK_RESTRICT dst, |
| 100 const float* SK_RESTRICT src, | 116 const float* SK_RESTRICT src, |
| 101 int count) { | 117 int count) { |
| 102 for (int i = 0; i < count; ++i) { | 118 for (int i = 0; i < count; ++i) { |
| 103 dst[i] = 1.0f / sk_float_sqrt(src[i]); | 119 dst[i] = 1.0f / sk_float_sqrt(src[i]); |
| 104 } | 120 } |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 DEF_BENCH(return new DivModBench<uint64_t>("uint64_t")) | 559 DEF_BENCH(return new DivModBench<uint64_t>("uint64_t")) |
| 544 | 560 |
| 545 DEF_BENCH(return new DivModBench<int8_t>("int8_t")) | 561 DEF_BENCH(return new DivModBench<int8_t>("int8_t")) |
| 546 DEF_BENCH(return new DivModBench<int16_t>("int16_t")) | 562 DEF_BENCH(return new DivModBench<int16_t>("int16_t")) |
| 547 DEF_BENCH(return new DivModBench<int32_t>("int32_t")) | 563 DEF_BENCH(return new DivModBench<int32_t>("int32_t")) |
| 548 DEF_BENCH(return new DivModBench<int64_t>("int64_t")) | 564 DEF_BENCH(return new DivModBench<int64_t>("int64_t")) |
| 549 | 565 |
| 550 /////////////////////////////////////////////////////////////////////////////// | 566 /////////////////////////////////////////////////////////////////////////////// |
| 551 | 567 |
| 552 DEF_BENCH( return new NoOpMathBench(); ) | 568 DEF_BENCH( return new NoOpMathBench(); ) |
| 569 DEF_BENCH( return new SkRSqrtMathBench(); ) |
| 553 DEF_BENCH( return new SlowISqrtMathBench(); ) | 570 DEF_BENCH( return new SlowISqrtMathBench(); ) |
| 554 DEF_BENCH( return new FastISqrtMathBench(); ) | 571 DEF_BENCH( return new FastISqrtMathBench(); ) |
| 555 DEF_BENCH( return new QMul64Bench(); ) | 572 DEF_BENCH( return new QMul64Bench(); ) |
| 556 DEF_BENCH( return new QMul32Bench(); ) | 573 DEF_BENCH( return new QMul32Bench(); ) |
| 557 | 574 |
| 558 DEF_BENCH( return new IsFiniteBench(-1); ) | 575 DEF_BENCH( return new IsFiniteBench(-1); ) |
| 559 DEF_BENCH( return new IsFiniteBench(0); ) | 576 DEF_BENCH( return new IsFiniteBench(0); ) |
| 560 DEF_BENCH( return new IsFiniteBench(1); ) | 577 DEF_BENCH( return new IsFiniteBench(1); ) |
| 561 DEF_BENCH( return new IsFiniteBench(2); ) | 578 DEF_BENCH( return new IsFiniteBench(2); ) |
| 562 DEF_BENCH( return new IsFiniteBench(3); ) | 579 DEF_BENCH( return new IsFiniteBench(3); ) |
| 563 DEF_BENCH( return new IsFiniteBench(4); ) | 580 DEF_BENCH( return new IsFiniteBench(4); ) |
| 564 DEF_BENCH( return new IsFiniteBench(5); ) | 581 DEF_BENCH( return new IsFiniteBench(5); ) |
| 565 | 582 |
| 566 DEF_BENCH( return new FloorBench(false); ) | 583 DEF_BENCH( return new FloorBench(false); ) |
| 567 DEF_BENCH( return new FloorBench(true); ) | 584 DEF_BENCH( return new FloorBench(true); ) |
| 568 | 585 |
| 569 DEF_BENCH( return new CLZBench(false); ) | 586 DEF_BENCH( return new CLZBench(false); ) |
| 570 DEF_BENCH( return new CLZBench(true); ) | 587 DEF_BENCH( return new CLZBench(true); ) |
| 571 | 588 |
| 572 DEF_BENCH( return new NormalizeBench(); ) | 589 DEF_BENCH( return new NormalizeBench(); ) |
| 573 | 590 |
| 574 DEF_BENCH( return new FixedMathBench(); ) | 591 DEF_BENCH( return new FixedMathBench(); ) |
| OLD | NEW |