[swift-dev] Measuring MEAN Performance (was: Questions about Swift-CI)

Andrew Trick atrick at apple.com
Mon Jun 12 16:55:15 CDT 2017

> On Jun 12, 2017, at 1:45 PM, Pavol Vaskovic <pali at pali.sk> wrote:
> On Tue, May 16, 2017 at 9:10 PM, Dave Abrahams via swift-dev <swift-dev at swift.org <mailto:swift-dev at swift.org>> wrote:
> on Thu May 11 2017, Pavol Vaskovic <swift-dev-AT-swift.org> wrote:
> I have run Benchmark_O with --num-iters=100 on my machine for the the
> whole performance test suite, to get a feeling for the distribution of
> benchmark samples, because I also want to move the Benchmark_Driver to
> use MEAN instead of MIN in the analysis.
> I'm concerned about that, especially for microbenchmarks; it seems to me
> as though MIN is the right measurement.  Can you explain why MEAN is
> better?
> On Wed, May 17, 2017 at 1:26 AM, Andrew Trick <atrick at apple.com <mailto:atrick at apple.com>> wrote:
> Using MEAN wasn’t part of the aforementioned SR-4669. The purpose of that task is to reduce the time CI takes to get useful results (e.g. by using 3 runs as a baseline). MEAN isn’t useful if you’re only gathering 3 data points.
> Current approach to detecting performance changes is fragile for tests that have very low absolute runtime, as they are easily over the 5% improvement/regression threshold when the test machine gets a little bit noisy. For example in benchmark on PR #9806 <https://github.com/apple/swift/pull/9806#issuecomment-303370149>:
> BitCount	12	14	+16.7%	0.86x
> SuffixCountableRange	10	11	+10.0%	0.91x
> MapReduce	303	331	+9.2%	0.92x
> These are all false changes (and there are quite a few more there).
> To partially address this issue (I'm guessing) the last SPEEDUP column sometimes features mysterious question mark in brackets. Its emitted when the new MIN falls inside the (MIN..MAX) range of the OLD baseline. It is not checked the other way around.

That bug must have been introduced during one of the rewrites. Is that in the driver or compare script? Why not fix that bug?

We clearly don’t want to see any false changes. The ‘?’ is a signal to me to avoid reporting those results. They should either be ignored as flaky benchmarks or rerun. I thought rerunning them was the fix you were working on.

If you have some other proposal for fixing this then please, in a separate proposal, explain your new approach, why your new approach works, and demonstrate it’s effectiveness with results that you’ve gathered over time on the side. Please don’t change how the driver computes performance changes on a whim while introducing other features.

> I'm suggesting to use MEAN value in combination with SD (standard-deviation) to detect the changes (improvements/regressions). At the moment, this is hard to do, because the aggregate test results reported by Benchmark_O (and co.) can include anomalous results in the sample population that messes up the MEAN and SD, too. Currently it is only visible in the high sample range - the difference between reported MIN and MAX. But it is not clear how many results are anomalous.

I honestly don’t know what MEAN/SD has to do with the problem you’re pointing to above. The benchmark harness is already setup to compute the average iteration time, and our benchmarks are not currently designed to measure cache effects or any other phenomenon that would have a statistically meaningful sample distribution. Statistical methods might be interesting if you’re analyzing benchmark results over a long period of time or system noise levels across benchmarks.

The primary purpose of the benchmark suite is identifying performance bugs/regressions at the point they occur. It should be no more complicated than necessary to do that. The current approach is simple: run a microbenchmark long enough in a loop to factor out benchmark startup time, cache/cpu warmup effects, and timer resolution, then compute the average iteration time. Throw away any run that was apparently impacted by system noise.

We really have two problems:
1. spurious results 
2. the turnaround time for the entire benchmark suite

Running benchmarks on a noisy machine is a losing proposition because you won’t be able to address problem #1 without making problem #2 much worse.


> Currently I'm working on improved sample filtering algorithm. Stay tuned for demonstration in Benchmark_Driver (Python), if it pans out, it might be time to change adaptive sampling in DriverUtil.swift.
> Best regards
> Pavol Vaskovic

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170612/3da4b53d/attachment.html>

More information about the swift-dev mailing list