Skip to content

Compiling HsInstances with optimisations is slow

DynFlags and HsInstances compile egregiously slowly. This has come to my attention repeatedly, but https://neilmitchell.blogspot.com/2019/03/ghc-rebuild-times-shake-profiling.html convinced me that we should really do something about this: Compare stage0 (-O2) and stage1 (-O0) builds by filtering for DynFlags and HsInstances here.

  • Compiling DynFlags and HsInstances with -O2 slows down a parallel build by 3 minutes
  • Compiling DynFlags with -O2 slows down by a factor of 6 (0:12 vs 1:17)
  • Compiling HsInstances with -O2 slows down by a factor of 8 (0:31 vs 4:20)

HsInstances is the worse of the two, but also more critical to GHC's performance. Profiling DynFlags for offending optimisations might be more viable.

Edited by Sebastian Graf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information