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

haskell: disable library profiling for static executables #45406

Conversation

basvandijk
Copy link
Member

@peti @ryantm I would like your review on this just in case I'm missing something.

Motivation for this change

Haskell packages overridden with justStaticExecutables (like cabal-install, stack, pandoc, darcs, etc.) don't provide libraries in the end result so it's futile to build them with library profiling enabled because it will just take extra time.

Things done

You can see that without this patch profiled libraries are build by default:

$ time nix-build -E 'let pkgs = import ./. {}; in pkgs.haskell.lib.triggerRebuild pkgs.hlint 1'
these derivations will be built:
  /nix/store/ffygpzmyrz8n9sprjn7k2bs67wbqm2hn-hlint-2.1.10.drv
...
[52 of 53] Compiling Language.Haskell.HLint3 ( src/Language/Haskell/HLint3.hs, dist/build/Language/Haskell/HLint3.o )
[53 of 53] Compiling Language.Haskell.HLint ( src/Language/Haskell/HLint.hs, dist/build/Language/Haskell/HLint.o )
[ 1 of 53] Compiling HSE.Type         ( src/HSE/Type.hs, dist/build/HSE/Type.p_o )
[ 2 of 53] Compiling HSE.Util         ( src/HSE/Util.hs, dist/build/HSE/Util.p_o )
...
0.57s user 0.05s system 1% cpu 41.737 total

With this patch they won't be build resulting in a faster build:

$ time nix-build -E 'let pkgs = import ./. {}; in pkgs.haskell.lib.triggerRebuild pkgs.hlint 2'
these derivations will be built:
  /nix/store/hxgp88ywqbkm6r64c1k3bad578rngc9i-hlint-2.1.10.drv
...
[52 of 53] Compiling Language.Haskell.HLint3 ( src/Language/Haskell/HLint3.hs, dist/build/Language/Haskell/HLint3.o )
[53 of 53] Compiling Language.Haskell.HLint ( src/Language/Haskell/HLint.hs, dist/build/Language/Haskell/HLint.o )
ignoring (possibly broken) abi-depends field for packages
Preprocessing executable 'hlint' for hlint-2.1.10..
Building executable 'hlint' for hlint-2.1.10..
...
0.54s user 0.07s system 2% cpu 29.988 total
  • 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)
  • Fits CONTRIBUTING.md.

@ryantm
Copy link
Member

ryantm commented Aug 20, 2018

@basvandijk This makes sense to me, but I don't really know enough to know if it is okay. Does this mean something like nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [mtl pandoc]) in "9.5.2.5. How to create ad hoc environments for nix-shell" already doesn't make the libraries associated with pandoc available in the nix shell?

@mpickering
Copy link
Contributor

@ryantm justStaticExecutables is used in all-packages.nix for haskell packages which live in there.

The attributes in haskellPackages are unaffected.

@basvandijk
Copy link
Member Author

@ryantm what @mpickering said. This mostly affects top-level attributes in all-packages.nix and doesn't affect haskell.packages.

@basvandijk
Copy link
Member Author

Assuming the label 10.rebuild-linux: 101-500 means that between 101 and 500 packages will be rebuild by this I think it's better if I base this on the haskell-updates branch so that those packages get build before this merges in master.

@basvandijk basvandijk force-pushed the justStaticExecutables-disableLibraryProfiling branch from 14492d6 to 91547d2 Compare August 20, 2018 23:29
@basvandijk basvandijk changed the base branch from master to haskell-updates August 20, 2018 23:29
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.

Looks good to me: 👍

@basvandijk basvandijk closed this Aug 21, 2018
@basvandijk basvandijk force-pushed the justStaticExecutables-disableLibraryProfiling branch from 91547d2 to bfd70a0 Compare August 21, 2018 14:05
@basvandijk
Copy link
Member Author

Thanks for the review guys. It's merged into haskell-updates.

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

5 participants