apply --match to image file names too, like we do for .skps
This should make skipping an image much cheaper.
Before:
$ time out/Release/nanobench --images resources/ --match sdkjlfasjlfds
4.65 real 4.41 user 0.19 sys
$ time out/Release/nanobench --images resources/ --match sdkjlfasjlfds
0.05 real 0.03 user 0.01 sys
The effect should be much more dramatic when there are more images to skip (e.g. on the bots).
This cuts about 6 minutes off the Debug CQ trybot.
BUG=skia:4768
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1577873002
Review URL: https://codereview.chromium.org/1577873002
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index b791ab7..cfac6be 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -743,6 +743,9 @@
fSourceType = "image";
fBenchType = "skcodec";
const SkString& path = fImages[fCurrentCodec];
+ if (SkCommandLineFlags::ShouldSkip(FLAGS_match, path.c_str())) {
+ continue;
+ }
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
if (!codec) {
@@ -810,11 +813,14 @@
}
// Run the DecodingBenches
- while (fCurrentImage < fImages.count()) {
+ for (; fCurrentImage < fImages.count(); fCurrentImage++) {
fSourceType = "image";
fBenchType = "skimagedecoder";
+ const SkString& path = fImages[fCurrentImage];
+ if (SkCommandLineFlags::ShouldSkip(FLAGS_match, path.c_str())) {
+ continue;
+ }
while (fCurrentColorType < fColorTypes.count()) {
- const SkString& path = fImages[fCurrentImage];
SkColorType colorType = fColorTypes[fCurrentColorType];
fCurrentColorType++;
// Check if the image decodes to the right color type
@@ -827,7 +833,6 @@
}
}
fCurrentColorType = 0;
- fCurrentImage++;
}
// Run the BRDBenches
@@ -856,12 +861,15 @@
// these tests are sufficient to provide good coverage of our scaling options.
const uint32_t sampleSizes[] = { 1, 2, 4, 8, 16, 32, 64 };
const uint32_t minOutputSize = 512;
- while (fCurrentBRDImage < fImages.count()) {
+ for (; fCurrentBRDImage < fImages.count(); fCurrentBRDImage++) {
+ const SkString& path = fImages[fCurrentBRDImage];
+ if (SkCommandLineFlags::ShouldSkip(FLAGS_match, path.c_str())) {
+ continue;
+ }
while (fCurrentBRDStrategy < (int) SK_ARRAY_COUNT(strategies)) {
fSourceType = "image";
fBenchType = strategies[fCurrentBRDStrategy].fName;
- const SkString& path = fImages[fCurrentBRDImage];
const SkBitmapRegionDecoder::Strategy strategy =
strategies[fCurrentBRDStrategy].fStrategy;
@@ -927,7 +935,6 @@
fCurrentBRDStrategy++;
}
fCurrentBRDStrategy = 0;
- fCurrentBRDImage++;
}
return nullptr;