Fix nanobench perf bug with large --ms values

When profiling with a large `--ms` value, the sample count could become
very large. We would still tell the Stats object that we wanted the plot
string (even though we weren't going to print it). Sadly, creation of
that string is O(n^2), thanks to SkString's allocation behavior.

Change-Id: I20ed61a49ab2827f3561673f086e7c5c298eaf86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445645
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2021-09-03 16:42:51 -04:00 committed by SkCQ
parent c3a0c8e5e7
commit 7ad42c0b16

View File

@ -1397,7 +1397,7 @@ int main(int argc, char** argv) {
// Building stats.plot often shows up in profiles,
// so skip building it when we're not going to print it anyway.
const bool want_plot = !FLAGS_quiet;
const bool want_plot = !FLAGS_quiet && !FLAGS_ms;
Stats stats(samples, want_plot);
log.beginObject(config);