circuithub / rel8

Hey! Hey! Can u rel8?
https://rel8.readthedocs.io
Other
150 stars 38 forks source link

compile times are extremely high #272

Open MangoIV opened 10 months ago

MangoIV commented 10 months ago

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 commented 10 months ago

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 commented 5 months ago

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.