<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 16, 2017 at 9:10 PM, Dave Abrahams via swift-dev <span dir="ltr">&lt;<a href="mailto:swift-dev@swift.org" target="_blank">swift-dev@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_-1742069484177758159gmail-"><br>
on Thu May 11 2017, Pavol Vaskovic &lt;swift-dev-AT-swift.org&gt; wrote:<br></span><span class="gmail-m_-1742069484177758159gmail-"><br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_-1742069484177758159gmail-">I have run Benchmark_O with --num-iters=100 on my machine for the the<br></span><span class="gmail-m_-1742069484177758159gmail-">whole performance test suite, to get a feeling for the distribution of<br></span><span class="gmail-m_-1742069484177758159gmail-">benchmark samples, because I also want to move the Benchmark_Driver to<br></span><span class="gmail-m_-1742069484177758159gmail-">use MEAN instead of MIN in the analysis.</span></blockquote><span class="gmail-m_-1742069484177758159gmail-">
<br>
</span>I&#39;m concerned about that, especially for microbenchmarks; it seems to me<br>
as though MIN is the right measurement.  Can you explain why MEAN is<br>
better?<br>
<span class="gmail-m_-1742069484177758159gmail-"><br></span></blockquote><div><br></div><div>On Wed, May 17, 2017 at 1:26 AM, Andrew Trick <span dir="ltr">&lt;<a href="mailto:atrick@apple.com" target="_blank">atrick@apple.com</a>&gt;</span> <wbr>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"></blockquote></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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.<br></blockquote><div><br></div><div><br></div><div>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 <a href="https://github.com/apple/swift/pull/9806#issuecomment-303370149" target="_blank">benchmark on PR #9806</a>:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><table style="box-sizing:border-box;border-collapse:collapse;margin-top:0px;margin-bottom:16px;display:block;width:668px;overflow:auto;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,&quot;Segoe UI&quot;,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,&quot;Segoe UI Symbol&quot;;font-size:14px"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box;border-top:1px solid rgb(198,203,209)"><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)">BitCount</td><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)">12</td><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)">14</td><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)">+16.7%</td><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)"><span style="box-sizing:border-box;font-weight:600">0.86x</span></td></tr><tr style="box-sizing:border-box;background-color:rgb(246,248,250);border-top:1px solid rgb(198,203,209)"><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)">SuffixCountableRange</td><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)">10</td><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)">11</td><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)">+10.0%</td><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)"><span style="box-sizing:border-box;font-weight:600">0.91x</span></td></tr><tr style="box-sizing:border-box;border-top:1px solid rgb(198,203,209)"><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)">MapReduce</td><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)">303</td><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)">331</td><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)">+9.2%</td><td style="box-sizing:border-box;padding:6px 13px;border:1px solid rgb(223,226,229)"><span style="box-sizing:border-box;font-weight:600">0.92x</span></td></tr></tbody></table></blockquote><div>These are all false changes (and there are quite a few more there).</div><div><br></div><div>To partially address this issue (I&#39;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.</div><div><br></div><div>I&#39;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.</div><div><br></div><div>Currently I&#39;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.</div><div><br></div><div><div>Best regards</div><div>Pavol Vaskovic</div></div><div><br></div><div><br></div></div></div></div>