Add a benchmark that measures SkSL::Compiler startup time

This is basically timing the rehydrator, but is helpful in conjunction
with heap usage if a client wants to decide to throw away a compiler
that they don't anticipate using for some amount of time.

Change-Id: Ie9b27d9a3b7667b5492d870f242cdafd00784708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320617
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
Brian Osman 2020-09-29 15:08:55 -04:00 committed by Skia Commit-Bot
parent 1a47d891c1
commit 24c5d2447f

View File

@ -9,6 +9,25 @@
#include "bench/SkSLBench.h"
#include "src/sksl/SkSLCompiler.h"
class SkSLCompilerStartupBench : public Benchmark {
protected:
const char* onGetName() override {
return "sksl_compiler_startup";
}
bool isSuitableFor(Backend backend) override {
return backend == kNonRendering_Backend;
}
void onDraw(int loops, SkCanvas*) override {
for (int i = 0; i < loops; i++) {
SkSL::Compiler compiler;
}
}
};
DEF_BENCH(return new SkSLCompilerStartupBench();)
class SkSLBench : public Benchmark {
public:
SkSLBench(SkSL::String name, const char* src)