Add regression test for renamer/typechecker performance regression in GHC 9
For a particular source file using the Happy parser generator, I have encountered a surprising compilation performance regression while preparing for an upgrade to GHC 9. Based on the output using
-dshow-passes, the slowdown appears under the renamer/typechecker phase. On my machine, that phase takes just over 2 seconds using GHC 8.10.4, and over 3 minutes using GHC 9.0.1. Nothing jumped out at me in the migration guide that suggests a likely cause or possible solution.
!!! Renamer/typechecker [Language.SystemVerilog.Parser.Parse]: finished in 2034.57 milliseconds, allocated 1692.102 megabytes
!!! Renamer/typechecker [Language.SystemVerilog.Parser.Parse]: finished in 170922.65 milliseconds, allocated 448529.159 megabytes
The source file can be found at: https://github.com/zachjs/sv2v/blob/master/src/Language/SystemVerilog/Parser/Parse.y. I use Stack to manage my dependencies. The GHC 8.10.4 results can be replicated by building the repo's HEAD. Changing the Stack resolver to, e.g.,
nightly-2021-08-20 can be used to replicate the GHC 9.0.1 results.
I have plenty of free cycles to try to further isolate this. Any suggestions on next steps would be greatly appreciated!