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

haskellPackages.stack: enableSharedExecutables = false; #20133

Closed
wants to merge 1 commit into from

Conversation

anderspapitto
Copy link
Contributor

@anderspapitto anderspapitto commented Nov 3, 2016

The stack binary has a large number of dependencies, and therefore
loads a large number of shared objects on startup (I count 20,000 open
syscalls with strace when running stack --version).

Statically linking haskell dependencies brings the time taken for stack --version from 1.3 seconds to 0.006 seconds on my machine. I think it's
worth it, since the binary is frequently invoked for short operations
during a dev workflow.

The `stack` binary has a large number of dependencies, and therefore
loads a large number of shared objects on startup (I count 20,000 `open`
syscalls with `strace` when running `stack --version`).

Statically linking haskell dependencies brings the time taken for `stack
--version` from 1.3 seconds to 0.006 seconds on my machine. I think it's
worth it, since the binary is frequently invoked for short operations
during a dev workflow.
@@ -157140,6 +157140,7 @@ self: {
QuickCheck resourcet retry smallcheck store template-haskell
temporary text th-reify-many transformers vector
];
enableSharedExecutables = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the only actual change, the rest is just automatic trailing whitespace removal (feel free to disregard it of course)

@anderspapitto
Copy link
Contributor Author

note: upstream ships stack as a statically linked binary. https://docs.haskellstack.org/en/stable/ChangeLog/

@anderspapitto
Copy link
Contributor Author

@peti what do you think? (the reviewer-adding bot seems to have not kicked in here)

@anderspapitto
Copy link
Contributor Author

note: code diff with whitespace changes ignored: https://github.com/NixOS/nixpkgs/pull/20133/files?w=1

@peti
Copy link
Member

peti commented Nov 25, 2016

We've been building a lean version of stack for quite some time: https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix#L4899-L4904.

@themoritz
Copy link
Contributor

themoritz commented Jan 26, 2017

When I install haskellPackages.stack, I get a dynamically linked executable and with it the slow startup times.

@anderspapitto Do you know what I need to do to get a statically linked one via nix? (ATM I'm manually downloading the statically linked executable from the stack github release page.)

Edit:

$ nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion
"17.03pre99414.b2b32ea"

@puffnfresh
Copy link
Contributor

@themoritz you want stack not haskellPackages.stack.

@themoritz
Copy link
Contributor

Awesome, thanks!

@anderspapitto anderspapitto deleted the static-link-stack branch March 10, 2018 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants