Skip to content

Very slow (8min w/ minimal exts, 18min with GHC2021) to typecheck reasonably-sized Happy grammar

Summary

I have a reasonably-sized (about 200 lines of grammar, about 130 lines of support code) Happy grammar that takes a whopping 18 minutes to build under GHC 9.0.1, when the extensions present in GHC2021 are in Cabal's default-extensions. It's down to 8 minutes when pared down to a minimal set. Passing -ddump-timings shows almost all the time being spent in typechecking.

The generated code is here.

Steps to reproduce

  • git clone https://git.sr.ht/~remexre/sylvan
  • cd sylvan/bootstrap
  • cabal build
  • Note the very long build times for Language.Sylvan.Parser

Expected behavior

Compile in not more than 2-3 minutes. (At least, not more than the rest of the project put together!)

Environment

  • GHC version used: 9.0.1

Optional:

  • Operating System: Linux (NixOS)
  • System Architecture: x86_64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information