Add interface-file size regression check to testsuite
In the course of investigating possible regressions in !3987 (closed), I came up with a very quick and easy way to check for interface file size: just run this in the libraries
directory after building GHC:
find . -path '*dist-install*.hi' -printf '%s\n' | ghc -e 'getContents >>= (print . sum . map read . lines)'
Maybe someone cleverer has a better way to do this, but this works. And I think we should have it as a statistical test in our testsuite, but with a very low threshold (I advocate for 0). Changes in the size of interface files would seem to have one of three causes:
- A change in the way
binary
works (very rare, presumably) - A change in interface-file format, in which case the patch author will want to know whether file size increased or decreased and by how much
- A change in the size of the serialized core (due to e.g. changes in optimizations), in which case the patch author will want to know whether core size increased or decreased and by how much
Regardless, knowing that there has been a change is very helpful. I don't think we should stop merging patches based on small regressions, but I still think the author should be made aware and have to accept the regression; this is nicely accomplished via the existing mechanism for accepting stat test changes.