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

compile times are extremely high #272

Open
MangoIV opened this issue Aug 30, 2023 · 3 comments
Open

compile times are extremely high #272

MangoIV opened this issue Aug 30, 2023 · 3 comments

Comments

@MangoIV
Copy link

MangoIV commented Aug 30, 2023

With ghc9.4.6 the compile times for small modules are really high (multiple minutes), is this expected or might this be a regression in the compiler?

@ocharles
Copy link
Contributor

ocharles commented Sep 5, 2023

Unfortunately this is somewhat known, but we don't really know what the root cause of the issue is. At CircuitHub, we tend to set -O0 on modules that take a significant amount of time to compile. Can you try that and see if it helps at all? It's unlikely Rel8 modules really much from an optimization, afaik.

@remeike
Copy link
Contributor

remeike commented Feb 4, 2024

So I've encountered similar issues with compile times. It didn't really hit me until my application had to build via a CI pipeline, where it would slow to a halt and max out my memory budget. I was able to narrow the issue down to records that were deriving Generic and Rel8able and noticed it got slower with larger records. Removing all optimizations with -O0 also did the trick for me, however I wanted to figure out which optimizations in particular might be causing the problem. After a bit of trial and error I found that it had something to do with the interface files being generated by GHC. By adding just these two pragmas, -fomit-interface-pragmas and -fignore-interface-pragmas, while keeping all of the other optimizations, I was able to get my compile times down dramatically and resolve the memory leak.

@gbaz
Copy link

gbaz commented Sep 20, 2024

We ran into the same issue, to the point of making the project effectively uncompilable on some users laptops, and the pragmas flags suggested by @remeike did the trick. This really should be added to the main rel8 documentation.

Just toss this on top of the file defining the rel8able instance:

{-# OPTIONS_GHC -fomit-interface-pragmas #-}
{-# OPTIONS_GHC -fignore-interface-pragmas #-}

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

4 participants