Index: bench/PDFBench.cpp |
diff --git a/bench/PDFBench.cpp b/bench/PDFBench.cpp |
index 76ee3cad0d57cda8015d82993528c5fecb446812..8f5d2db5b4a51b78f40307e452d583395b761643 100644 |
--- a/bench/PDFBench.cpp |
+++ b/bench/PDFBench.cpp |
@@ -208,6 +208,25 @@ struct WStreamWriteTextBenchmark : public Benchmark { |
} |
}; |
+struct WritePDFTextBenchmark : public Benchmark { |
+ std::unique_ptr<SkWStream> fWStream; |
tomhudson
2016/06/23 20:39:11
We prefer std::unique_ptr<> to sk_sp<>, I suppose?
hal.canary
2016/06/23 20:57:12
streams aren't ref-counted.
|
+ WritePDFTextBenchmark() : fWStream(new NullWStream) {} |
+ const char* onGetName() override { return "WritePDFText"; } |
+ bool isSuitableFor(Backend backend) override { |
+ return backend == kNonRendering_Backend; |
+ } |
+ void onDraw(int loops, SkCanvas*) override { |
+ static const char kHello[] = "HELLO SKIA!\n"; |
+ static const char kBinary[] = "\001\002\003\004\005\006"; |
+ while (loops-- > 0) { |
+ for (int i = 1000; i-- > 0;) { |
+ SkPDFUtils::WriteString(fWStream.get(), kHello, strlen(kHello)); |
+ SkPDFUtils::WriteString(fWStream.get(), kBinary, strlen(kBinary)); |
tomhudson
2016/06/23 20:39:11
Are we getting a free invisible string terminator
hal.canary
2016/06/23 20:57:12
yes
|
+ } |
+ } |
+ } |
+}; |
+ |
} // namespace |
DEF_BENCH(return new PDFImageBench;) |
DEF_BENCH(return new PDFJpegImageBench;) |
@@ -215,3 +234,4 @@ DEF_BENCH(return new PDFCompressionBench;) |
DEF_BENCH(return new PDFScalarBench;) |
DEF_BENCH(return new PDFShaderBench;) |
DEF_BENCH(return new WStreamWriteTextBenchmark;) |
+DEF_BENCH(return new WritePDFTextBenchmark;) |