aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/SkRasterPipelineBench.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-01-05 15:03:53 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-05 20:41:43 +0000
commita2d25ec0ef1b1054aa5b3e61280bd226fce4ab9a (patch)
tree9b63a117138b09374c30ee56b08a5dc05a424ac5 /bench/SkRasterPipelineBench.cpp
parent4a224f60111643f36d6f1c204142ce34511a32a1 (diff)
Use stack instead of malloc() for most calls to SkRasterPipeline::run().
Also split bench into run/compile variants to measure the effect: Before …f16_compile 1x …f16_run 1.02x …srgb_compile 1.56x …srgb_run 1.61x After …f16_run 1x …f16_compile 1.01x …srgb_compile 1.58x …srgb_run 1.59x CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I8e65fb2acdbb05ccc0b3894f16d7646603c3e74d Reviewed-on: https://skia-review.googlesource.com/6621 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'bench/SkRasterPipelineBench.cpp')
-rw-r--r--bench/SkRasterPipelineBench.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/bench/SkRasterPipelineBench.cpp b/bench/SkRasterPipelineBench.cpp
index 16dea8aa66..376efdeb84 100644
--- a/bench/SkRasterPipelineBench.cpp
+++ b/bench/SkRasterPipelineBench.cpp
@@ -22,13 +22,18 @@ static uint8_t mask[N]; // 8-bit linear
// - src = srcover(dst, src)
// - store src back as srgb/f16
-template <bool kF16>
+template <bool kF16, bool kCompiled>
class SkRasterPipelineBench : public Benchmark {
public:
bool isSuitableFor(Backend backend) override { return backend == kNonRendering_Backend; }
const char* onGetName() override {
- return kF16 ? "SkRasterPipeline_f16"
- : "SkRasterPipeline_srgb";
+ switch ((int)kCompiled << 1 | (int)kF16) {
+ case 0: return "SkRasterPipeline_srgb_run";
+ case 1: return "SkRasterPipeline_f16_run";
+ case 2: return "SkRasterPipeline_srgb_compile";
+ case 3: return "SkRasterPipeline_f16_compile";
+ }
+ return "whoops";
}
void onDraw(int loops, SkCanvas*) override {
@@ -53,12 +58,20 @@ public:
p.append(SkRasterPipeline::to_srgb);
p.append(SkRasterPipeline::store_8888, &dst_ctx);
}
- auto compiled = p.compile();
- while (loops --> 0) {
- compiled(0,0, N);
+ if (kCompiled) {
+ auto compiled = p.compile();
+ while (loops --> 0) {
+ compiled(0,0, N);
+ }
+ } else {
+ while (loops --> 0) {
+ p.run(0,0, N);
+ }
}
}
};
-DEF_BENCH( return new SkRasterPipelineBench<true>; )
-DEF_BENCH( return new SkRasterPipelineBench<false>; )
+DEF_BENCH( return (new SkRasterPipelineBench< true, true>); )
+DEF_BENCH( return (new SkRasterPipelineBench<false, true>); )
+DEF_BENCH( return (new SkRasterPipelineBench< true, false>); )
+DEF_BENCH( return (new SkRasterPipelineBench<false, false>); )