Describe the bug
ormolu is significantly slower when formatting expressions that mix operators of different fixities if ormolu was built with fixity-th enabled (which is the default).
To Reproduce
To reproduce this behavior, build ormolu with the fixity-th flag enabled (which is the default) and then format the following file:
This will take a while (≈ 43 seconds on my machine).
The problem disappears if you build ormolu without the fixity-th flag or if you build using GHC 9.2 or older. In those cases formatting speed goes back to normal (≈ 0.2 seconds).
Expected behavior
The performance with fixity-th shouldn't be significantly slower than without fixity-th. My understanding is that the fixity-th flag is supposed to be an optimization (to compile the fixity look-up table at compile-time using TemplateHaskell instead of decoding the look-up table at runtime) but in this case it's actually significantly less efficient due to some change introduced in GHC 9.4.
Environment
Describe the bug
ormoluis significantly slower when formatting expressions that mix operators of different fixities iformoluwas built withfixity-thenabled (which is the default).To Reproduce
To reproduce this behavior, build
ormoluwith thefixity-thflag enabled (which is the default) and then format the following file:This will take a while (≈ 43 seconds on my machine).
The problem disappears if you build
ormoluwithout thefixity-thflag or if you build using GHC 9.2 or older. In those cases formatting speed goes back to normal (≈ 0.2 seconds).Expected behavior
The performance with
fixity-thshouldn't be significantly slower than withoutfixity-th. My understanding is that thefixity-thflag is supposed to be an optimization (to compile the fixity look-up table at compile-time usingTemplateHaskellinstead of decoding the look-up table at runtime) but in this case it's actually significantly less efficient due to some change introduced in GHC 9.4.Environment
macOS 13.0.1
x86_64-darwinNote: I'm actually on an M1 mac, but I compile for
x86_64-darwindue issues buildingormoluwithfixity-thenabled onaarch64-darwin. For more details, see: Haskell language server fails to build on aarch64-darwin NixOS/nixpkgs#194367ormolu-0.5.1.0ghc-9.4.2