<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-09-23 21:06 GMT+02:00 Joachim Breitner <span dir="ltr"><<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">what I want to do is to reliably catch regressions.</blockquote><div><br></div><div>The main question is: Which kind of regressions do you want to catch? Do you care about runtime as experienced by the user? Measure the runtime. Do you care abou code size? Measure the code size. etc. etc. Measuring things like the number of fetched instructions as an indicator for the experienced runtime is basically a useless exercise, unless you do this on ancient RISC processors, where each instruction takes a fixed number of cycles.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> What are the odds that a change to the Haskell compiler (in particular to Core2Core<br>
transformations) will cause a significant increase in runtime without a<br>
 significant increase in instruction count?<br>
(Honest question, not rhetoric).<br></blockquote><div><br></div><div>The odds are actually quite high, especially when you define "significant" as "changing a few percent" (which we do!). Just a few examples from current CPUs:</div><div><br></div><div>   * If branch prediction has not enough information to do this better, it assumes that backward branches are taken (think: loops) and forward branches are not taken (so you should put "exceptional" code out of the common, straight-line code). If by some innocent looking change the code layout changes, you can easily get a very measurable difference in runtime even if the number of executed instructions stays exactly the same.</div><div><br></div><div>   * Even if the number of instructions changes only a tiny bit, it could be the case that it is just enough to make caching much worse and/or make the loop stream detector fail to detect a loop.</div><div><br></div><div>There are lots of other scenarios, so in a nutshell: Measure what you really care about, not something you think might be related to that.</div><div><br></div><div>As already mentioned in another reply, "perf" can give you very detailed hints about how good your program uses the pipeline, caches, branch prediction etc. Perhaps the performance dashboard should really collect these, too, this would remove a lot of guesswork.</div></div></div></div>