Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pathological compilation behavior with GHC 9.8.1 #51

Open
m4dc4p opened this issue Feb 21, 2024 · 2 comments
Open

Pathological compilation behavior with GHC 9.8.1 #51

m4dc4p opened this issue Feb 21, 2024 · 2 comments

Comments

@m4dc4p
Copy link

m4dc4p commented Feb 21, 2024

I've found that a module using barbies takes exponentially longer to compile under GHC 9.8 as I add fields to a data type.

The repo at https://github.com/m4dc4p/ghc98-bug demonstrates the problem. If you have GHC and cabal installed, you should be able to build with just cabal build:

$ cabal build
Warning: The package list for 'hackage.haskell.org' is 19 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Build profile: -w ghc-9.8.1 -O1
In order, the following will be built (use -v for more details):
 - ghc98-bug-0.0.0 (lib) (first run)
Configuring library for ghc98-bug-0.0.0..
Preprocessing library for ghc98-bug-0.0.0..
Building library for ghc98-bug-0.0.0..

Uncommenting fields on the HDKType data constructor cause compilation to take longer and longer (and use more memory):

  • 1 field - 2.5s, 198MB peak
  • 2 fields - 7s, 1.0GB peak
  • 3 fields - 26.8s, 4.6GB peak
  • 4 fields - 82.9s, 14.5GB peak

Its worth noting the removing the deriving instance for Eq causes the problem to go away (but, of course, that instance is something we want). Also worth noting that with -O0, the problem goes away. I have not narrowed down which optimization is the problem.

@jcpetruzza
Copy link
Owner

Thanks for flagging! Just to confirm, this is a regression, correct? Is there a ghc issue tracking this?

@m4dc4p
Copy link
Author

m4dc4p commented Feb 21, 2024

Yeh, under 9.6 this does not happen. I reported to GHC just after this as well - https://gitlab.haskell.org/ghc/ghc/-/issues/24462.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants