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

Add disable core optimizations #51464

Merged
merged 3 commits into from Dec 3, 2018
Merged

Add disable core optimizations #51464

merged 3 commits into from Dec 3, 2018

Conversation

dmjio
Copy link
Member

@dmjio dmjio commented Dec 3, 2018

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
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

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"];
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

@dmjio dmjio Dec 3, 2018

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please.

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cabal v1-configure --help 

Copy link
Member Author

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.
Copy link
Member

@peti peti left a 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`
@peti peti merged commit e42d109 into NixOS:master Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants