aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/SkRasterPipelineBench.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-05-22 12:01:59 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-22 16:41:22 +0000
commit0a76b413eac46ec218b367c5456709059557f5db (patch)
treeacf1df36b1d2a8302e69beb3221a22da154ccdf4 /bench/SkRasterPipelineBench.cpp
parent929bfeb17c4d6c422c17027a18640af8d710d030 (diff)
add compile, use it in blitter
I expanded an existing bench to show off the difference: SkRasterPipeline_… 300 …compile 1x …run 1.14x Change-Id: I5d63d602cda3f78d2d0891fcc85baf5514632900 Reviewed-on: https://skia-review.googlesource.com/17458 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'bench/SkRasterPipelineBench.cpp')
-rw-r--r--bench/SkRasterPipelineBench.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/bench/SkRasterPipelineBench.cpp b/bench/SkRasterPipelineBench.cpp
index 2848218977..bef80b3fca 100644
--- a/bench/SkRasterPipelineBench.cpp
+++ b/bench/SkRasterPipelineBench.cpp
@@ -66,11 +66,13 @@ public:
DEF_BENCH( return (new SkRasterPipelineBench< true>); )
DEF_BENCH( return (new SkRasterPipelineBench<false>); )
-class SkRasterPipelineLegacyBench : public Benchmark {
+class SkRasterPipelineCompileVsRunBench : public Benchmark {
public:
+ explicit SkRasterPipelineCompileVsRunBench(bool compile) : fCompile(compile) {}
bool isSuitableFor(Backend backend) override { return backend == kNonRendering_Backend; }
const char* onGetName() override {
- return "SkRasterPipeline_legacy";
+ return fCompile ? "SkRasterPipeline_compile"
+ : "SkRasterPipeline_run";
}
void onDraw(int loops, SkCanvas*) override {
@@ -84,12 +86,24 @@ public:
p.append(SkRasterPipeline::srcover);
p.append(SkRasterPipeline::store_8888, &dst_ctx);
- while (loops --> 0) {
- p.run(0,N);
+ if (fCompile) {
+ char buffer[1024];
+ SkArenaAlloc alloc(buffer);
+ auto fn = p.compile(&alloc);
+ while (loops --> 0) {
+ fn(0,N);
+ }
+ } else {
+ while (loops --> 0) {
+ p.run(0,N);
+ }
}
}
+private:
+ bool fCompile;
};
-DEF_BENCH( return (new SkRasterPipelineLegacyBench); )
+DEF_BENCH( return (new SkRasterPipelineCompileVsRunBench(true )); )
+DEF_BENCH( return (new SkRasterPipelineCompileVsRunBench(false)); )
static SkColorSpaceTransferFn gamma(float g) {
SkColorSpaceTransferFn fn = {0,0,0,0,0,0,0};