Problem with compiler perf tests

Ben Gamari ben at
Sun Nov 17 11:27:38 UTC 2019

On November 17, 2019 3:22:59 AM EST, "Ömer Sinan Ağacan" <omeragacan at> wrote:
>Currently we have a bunch of tests in testsuite/tests/perf/compiler for
>compile time allocations, max residency etc. in the expected ranges and
>introducing accidental compile time performance regressions.
>This has a problem: we expect every MR to keep the compile time stats
>in the
>specified ranges, but sometimes a patch fixes an issue, or does
>something right
>(removes hacks/refactors bad code etc.) but also increases the numbers
>sometimes doing it right means doing more work or keeping more things
>in memory
>(e.g. !1747, !2100 which is required by !1304).
>We then spend hours/days trying to shave a few bytes off in those
>because the previous hacky/buggy code set the standards. It doesn't
>make sense
>to compare bad/buggy code with good code and expect them to do the same
>Second problem is that it forces the developer to focus on a tiny part
>of the
>compiler to reduce the numbers to the where they were. If they looked
>at the big
>picture instead it might be possible to see rooms of improvements in
>places that could be possibly lead to much more efficient use of the
>I think what we should do instead is that once it's clear that the
>patch did not
>introduce *accidental* increases in numbers (e.g. in !2100 I checked
>explained the increase in average residency, and showed that the
>increase makes
>sense and is not a leak) and it's the right thing to do, we should
>merge it, and
>track the performance issues in another issue. The CI should still run
>tests, but those should be allowed to fail.

To be clear, our policy is not that GHC's performance tests should never regress. You are quite right that it is sometimes unrealistic to expect a patch fixing previously-incorrect behavior to do so without introducing additional cost. 

However, we do generally want to ensure that we aren't introducing low-hanging regressions. This is most easily done before the merge request is merged, when a developer has the relevant bits of the design (both new and old) fresh in mind and a clear picture of the structure of their implementation. 

This is of course a tradeoff. At some point we must conclude that the marginal benefit of investigating any potential regressions is outweighed by that of using that effort elsewhere in the compiler. This is inevitably a judgement call. 

In the specific case of !2100 I think we probably have crossed this threshold. The overall ~0.1% compile time regression that you report seems reasonable and I doubt that further work on this particular patch will eliminate this. 

However, it also seems that in this particular case there are outstanding design questions which have yet to be addressed (specifically the exchange between you and Simon regarding PartialModIface which has more to do with implementation clarity than performance). I agree with Simon that we should avoid committing this patch in two pieces if unless there is a good reason. Perhaps you have such a reason? 


- Ben 

Sent from my Android device with K-9 Mail. Please excuse my brevity.

More information about the ghc-devs mailing list