aboutsummaryrefslogtreecommitdiff
path: root/bench/nanobench.cpp
diff options
context:
space:
mode:
authorBrian Osman <brianosman@google.com>2018-09-19 14:14:15 -0400
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2018-09-19 18:35:59 +0000
commit133823d9a7058b22e92816d467610c02fac74e77 (patch)
tree1d60ba8ec2d5e4c7a86d1b3b555d77497135b5e3 /bench/nanobench.cpp
parent4a3f5c81410cbf205bcdab47107ebaa7aaa6f3c0 (diff)
downloadskqp-133823d9a7058b22e92816d467610c02fac74e77.tar.gz
Load SVGs into memory before parsing
On my Z840, Windows-Clang-Debug, this cuts the total time to construct (parse) the 72 SVG sources from 66 seconds to 40 seconds. That's still awful, but all the time is now spent in expat, so further improvements will require higher level changes. Bug: skia: Change-Id: I0dca67ee18652f6fb8647fe8706716d9a01f7cdf Reviewed-on: https://skia-review.googlesource.com/155603 Commit-Queue: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@google.com> Auto-Submit: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'bench/nanobench.cpp')
-rw-r--r--bench/nanobench.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index afe7b71bdb..2e94426358 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -670,13 +670,14 @@ public:
}
static sk_sp<SkPicture> ReadSVGPicture(const char* path) {
- SkFILEStream stream(path);
- if (!stream.isValid()) {
+ sk_sp<SkData> data(SkData::MakeFromFileName(path));
+ if (!data) {
SkDebugf("Could not read %s.\n", path);
return nullptr;
}
#ifdef SK_XML
+ SkMemoryStream stream(std::move(data));
sk_sp<SkSVGDOM> svgDom = SkSVGDOM::MakeFromStream(stream);
if (!svgDom) {
SkDebugf("Could not parse %s.\n", path);