aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-08-21 15:51:22 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-21 15:51:22 -0700
commit2084050a33ae139d0fe9bb680f7905f91139a39f (patch)
tree0293feb13a87675d14f40961b666e253163a45f6 /bench
parentc6765d69e3aceaa316fe2d2ef00a7f0d138def2f (diff)
Add --bbh (default true) to nanobench.
Chrome's using a bounding box, so it's a good idea for our bots to do so too. When set, we'll create an SkTileGrid to match the parameters of --clip, and so should always hit its fast path. This will impose a small overhead (querying the BBH) on all SKPs, but make large SKPs render more quickly. E.g. on GPU desk_pokemonwiki should show about a 30% improvement, tabl_mozilla about 40%, and one very long page from my personal suite, askmefast.com, gets 5x faster. (The performance changes are not the point of the CL, but something we should be aware of.) BUG= R=bsalomon@google.com, mtklein@google.com, robertphillips@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/497493003
Diffstat (limited to 'bench')
-rw-r--r--bench/nanobench.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 6968d6dac2..89619164fd 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -16,11 +16,13 @@
#include "Stats.h"
#include "Timer.h"
-#include "SkOSFile.h"
+#include "SkBBHFactory.h"
#include "SkCanvas.h"
#include "SkCommonFlags.h"
#include "SkForceLinking.h"
#include "SkGraphics.h"
+#include "SkOSFile.h"
+#include "SkPictureRecorder.h"
#include "SkString.h"
#include "SkSurface.h"
@@ -71,6 +73,7 @@ DEFINE_string(key, "",
DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs.");
DEFINE_string(scales, "1.0", "Space-separated scales for SKPs.");
+DEFINE_bool(bbh, true, "Build a BBH for SKPs?");
static SkString humanize(double ms) {
if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3);
@@ -481,6 +484,20 @@ public:
SkString name = SkOSPath::Basename(path.c_str());
+ if (FLAGS_bbh) {
+ // The SKP we read off disk doesn't have a BBH. Re-record so it grows one.
+ // Here we use an SkTileGrid with parameters optimized for FLAGS_clip.
+ const SkTileGridFactory::TileGridInfo info = {
+ SkISize::Make(fClip.width(), fClip.height()), // tile interval
+ SkISize::Make(0,0), // margin
+ SkIPoint::Make(fClip.left(), fClip.top()), // offset
+ };
+ SkTileGridFactory factory(info);
+ SkPictureRecorder recorder;
+ pic->draw(recorder.beginRecording(pic->width(), pic->height(), &factory));
+ pic.reset(recorder.endRecording());
+ }
+
fSourceType = "skp";
return SkNEW_ARGS(SKPBench,
(name.c_str(), pic.get(), fClip, fScales[fCurrentScale]));