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
Add disable core optimizations #51464
Conversation
Adds a utility function for disabling GHC core optimizations. Significantly increases build times.
@@ -259,6 +259,9 @@ rec { | |||
*/ | |||
buildStrictly = pkg: buildFromSdist (failOnAllWarnings pkg); | |||
|
|||
/* Disable core optimizations, significantly speeds up build time */ | |||
disableCoreOpts = pkg: appendConfigureFlags pkg ["--ghc-options=-O0"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not pass --disable-optimization
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware it existed, what is the difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One flag works for ghc
only, the other one one works for all compilers that Cabal supports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does nix have any Haskell compilers besides GHC?
nix-repl> haskell.compiler.
haskell.compiler.ghc821Binary haskell.compiler.ghc861 haskell.compiler.ghcjs haskell.compiler.integer-simple
haskell.compiler.ghc822 haskell.compiler.ghc862 haskell.compiler.ghcjs82
haskell.compiler.ghc844 haskell.compiler.ghcHEAD haskell.compiler.ghcjs84
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does nix have any Haskell compilers besides GHC?
Does it matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peti, I've never seen that flag, it must not be documented.
ghc --show-options | grep disable
Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peti it is finished, is it ok if we squash merge from the GitHub UI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cabal v1-configure --help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peti, thanks, always just done ghc-options=-O0
.
Prefer `--disable-optimization` for reasons of portability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about calling that function disableOptimization
?
Name function `disableOptimization`
Adds a utility function for disabling GHC core optimizations.
Significantly increases build times.
Motivation for this change
This change is common enough it warrants its own function
This change will allow new Haskell / Nix users to speed up builds.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)