Pattern match checker can be very slow
Summary
While trying to update the UHC compiler to be able to compile it with GHC 8.10 I noticed one file that took very long to compile. I enabled -dshow-passes
and it turns out to take very long in the desugar pass. I have now ripped out the module and wrote a bunch of stubs such that it passes the typechecker:
Note that most of the code is automatically generated by the uuagc
and shuffle
tools, so it is a bit strange.
Steps to reproduce
Extract the zip and then run ghc -dshow-passes Repro.hs
and notice a very long compile time.
The exact time for the Renamer pass of the Repro module on my machine is: 1249801.78 milliseconds (about 20 min) for GHC 9.0.1
Expected behavior
The module is quite large, so I expected a relatively long compile time, but I did not expect that it would take more than 5 minutes for this one file.
Comments
I would also like to note that I believe this is a regression. Previous maintainers of UHC don't remember having such long compile times with GHC 6 or 7 (I'm not certain which versions were used previously).
I also think I notice a large difference between GHC 8.10.4 and 9.0.1. With GHC 8.10.4 I wasn't able to compile UHC at all within a few hours, while GHC 9.0.1 took at least 30 minutes for this one module alone.
Environment
- GHC version used: 8.10.4, 9.0.1 and 9.3.20210504