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

Slowdown on GHC 9.4 when fixity-th configure flag is enabled #941

Closed
Gabriella439 opened this issue Nov 17, 2022 · 3 comments · Fixed by #954
Closed

Slowdown on GHC 9.4 when fixity-th configure flag is enabled #941

Gabriella439 opened this issue Nov 17, 2022 · 3 comments · Fixed by #954
Assignees
Labels
bug-upstream Something upstream is not working.

Comments

@Gabriella439
Copy link

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:

a = b =. c <$> d

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

@MaxGabriel
Copy link

(I have also reproduced this on a regular Intel Mac, in case anyone is worried about the M1 running x86 causing weirdness)

Gabriella439 added a commit to MercuryTechnologies/nixpkgs that referenced this issue Nov 17, 2022
@amesgen amesgen added the bug-upstream Something upstream is not working. label Nov 17, 2022
@amesgen
Copy link
Member

amesgen commented Nov 17, 2022

Interesting, thanks for the report! I can reproduce this on x86_64-linux using GHC 9.4.3 (and also on 9.4.2). The fixity-th flag seems to be a magnet for GHC bugs, cf. #927...

@amesgen
Copy link
Member

amesgen commented Dec 10, 2022

PR to disable fixity-th on GHC 9.4 for the time being: #945

@mrkkrp mrkkrp self-assigned this Jan 3, 2023
mrkkrp added a commit that referenced this issue Jan 3, 2023
The flag caused problems on GHC 9.4 and generally was a magnet for bugs, see
#941 and
#927. We are going to try to use
file-embed unconditionally and make parsing more efficient instead.
mrkkrp added a commit that referenced this issue Jan 3, 2023
The flag caused problems on GHC 9.4 and generally was a magnet for bugs, see
#941 and
#927. We are going to try to use
file-embed unconditionally and make parsing more efficient instead.
mrkkrp added a commit that referenced this issue Jan 3, 2023
The flag caused problems on GHC 9.4 and generally was a magnet for bugs, see
#941 and
#927. We are going to try to use
file-embed unconditionally and make parsing more efficient instead.
mrkkrp added a commit that referenced this issue Jan 3, 2023
The flag caused problems on GHC 9.4 and generally was a magnet for bugs, see
#941 and
#927. We are going to try to use
file-embed unconditionally and make parsing more efficient instead.
mrkkrp added a commit that referenced this issue Jan 3, 2023
The flag caused problems on GHC 9.4 and generally was a magnet for bugs, see
#941 and
#927. We are going to try to use
file-embed unconditionally and make parsing more efficient instead.
mrkkrp added a commit that referenced this issue Jan 3, 2023
The flag caused problems on GHC 9.4 and generally was a magnet for bugs, see
#941 and
#927. We are going to try to use
file-embed unconditionally and make parsing more efficient instead.

Co-authored-by: amesgen <alexander.esgen@tweag.io>
mrkkrp added a commit that referenced this issue Jan 3, 2023
The flag caused problems on GHC 9.4 and generally was a magnet for bugs, see
#941 and
#927. We are going to try to use
file-embed unconditionally and make parsing more efficient instead.

Co-authored-by: amesgen <alexander.esgen@tweag.io>
j6carey pushed a commit to awakesecurity/nixpkgs that referenced this issue Sep 27, 2023
j6carey pushed a commit to awakesecurity/nixpkgs that referenced this issue Nov 10, 2023
jsoo1 pushed a commit to awakesecurity/nixpkgs that referenced this issue Nov 13, 2023
j6carey pushed a commit to awakesecurity/nixpkgs that referenced this issue Dec 17, 2023
jsoo1 pushed a commit to awakesecurity/nixpkgs that referenced this issue Dec 19, 2023
jsoo1 pushed a commit to awakesecurity/nixpkgs that referenced this issue Dec 20, 2023
jsoo1 pushed a commit to awakesecurity/nixpkgs that referenced this issue Dec 22, 2023
jsoo1 pushed a commit to awakesecurity/nixpkgs that referenced this issue Jan 13, 2024
tm-drtina pushed a commit to awakesecurity/nixpkgs that referenced this issue Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-upstream Something upstream is not working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants