aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/MathBench.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-08 20:14:16 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-08 20:14:16 +0000
commit11e5b972a984c7b4e09ba4dfeacc7bd805107c5a (patch)
tree8b819ae42f35273010e987ce02363e381e6d2466 /bench/MathBench.cpp
parent8f457e3230f1a4ce737f512ffbb5c919b8d02407 (diff)
Add sk_float_rsqrt with SSE + NEON fast paths.
Current numbers: N4: running bench [640 480] math_fastIsqrt NONRENDERING: cmsecs = 3.12 running bench [640 480] math_slowIsqrt NONRENDERING: cmsecs = 4.82 running bench [640 480] math_sk_float_rsqrt NONRENDERING: cmsecs = 1.99 Desktop: running bench [640 480] math_fastIsqrt NONRENDERING: cmsecs = 0.89 running bench [640 480] math_slowIsqrt NONRENDERING: cmsecs = 0.94 running bench [640 480] math_sk_float_rsqrt NONRENDERING: cmsecs = 0.09 Haven't found any other benches where this is a significant effect yet. BUG= R=reed@google.com Author: mtklein@google.com Review URL: https://codereview.chromium.org/60083014 git-svn-id: http://skia.googlecode.com/svn/trunk@12203 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/MathBench.cpp')
-rw-r--r--bench/MathBench.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/bench/MathBench.cpp b/bench/MathBench.cpp
index abe04e13d7..6327c3c580 100644
--- a/bench/MathBench.cpp
+++ b/bench/MathBench.cpp
@@ -92,6 +92,22 @@ private:
typedef MathBench INHERITED;
};
+class SkRSqrtMathBench : public MathBench {
+public:
+ SkRSqrtMathBench() : INHERITED("sk_float_rsqrt") {}
+protected:
+ virtual void performTest(float* SK_RESTRICT dst,
+ const float* SK_RESTRICT src,
+ int count) {
+ for (int i = 0; i < count; ++i) {
+ dst[i] = sk_float_rsqrt(src[i]);
+ }
+ }
+private:
+ typedef MathBench INHERITED;
+};
+
+
class SlowISqrtMathBench : public MathBench {
public:
SlowISqrtMathBench() : INHERITED("slowIsqrt") {}
@@ -550,6 +566,7 @@ DEF_BENCH(return new DivModBench<int64_t>("int64_t"))
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new NoOpMathBench(); )
+DEF_BENCH( return new SkRSqrtMathBench(); )
DEF_BENCH( return new SlowISqrtMathBench(); )
DEF_BENCH( return new FastISqrtMathBench(); )
DEF_BENCH( return new QMul64Bench(); )