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

build-node-package.nix takes excessive amount of time #18090

Closed
edolstra opened this issue Aug 29, 2016 · 6 comments
Closed

build-node-package.nix takes excessive amount of time #18090

edolstra opened this issue Aug 29, 2016 · 6 comments

Comments

@edolstra
Copy link
Member

Issue description

A profile of NIX_COUNT_CALLS=1 nix-env -qa --drv-path on Nixpkgs master shows that build-node-package.nix is the most dominant function during evaluation:

calls to 9295 functions:
    210846 anonymous function at /home/eelco/Dev/nixpkgs-stable/pkgs/development/web/nodejs/build-node-package.nix:314:33
    201017 anonymous function at /home/eelco/Dev/nixpkgs-stable/pkgs/tools/typesetting/tex/texlive-new/combine.nix:31:36
    201017 anonymous function at /home/eelco/Dev/nixpkgs-stable/pkgs/tools/typesetting/tex/texlive-new/combine.nix:31:39
     93926 ‘optional’ at /home/eelco/Dev/nixpkgs-stable/lib/lists.nix:175:14
     93926 ‘optional’ at /home/eelco/Dev/nixpkgs-stable/lib/lists.nix:175:20
...

In fact about 23% of Nixpkgs evaluation time is spent in nodejs stuff.

This is strange because hardly any nodejs packages are included in the output:

$ nix-env -f ~/Dev/nixpkgs -qa --drv-path | grep nodejs | wc -l
14

So it looks like there is some opportunity for optimisation here...

Steps to reproduce

Technical details

  • System: 16.03.git.7a41a40M
  • Nix version: 1.11.2
  • Nixpkgs version: 8a84fc0
@domenkozar
Copy link
Member

I wonder, how do you know 23% of time is spent on nodejs stuff?

@edolstra
Copy link
Member Author

Just by disabling node-packages.nix:

diff --git a/pkgs/top-level/node-packages.nix b/pkgs/top-level/node-packages.nix
index d8eb668..3d9cf8d 100644
--- a/pkgs/top-level/node-packages.nix
+++ b/pkgs/top-level/node-packages.nix
@@ -15,7 +15,7 @@
 , ...
 } @ args:

-with stdenv.lib;
+with stdenv.lib; assert false;

 let
   removeDeps = remove: deps: filterAttrs (n: d: all (r: r != d.pkgName) remove) deps;

@domenkozar
Copy link
Member

There is some deep magic in pkgs/development/web/nodejs/build-node-package.nix.

So hopefully #16886 will yield #14532

@domenkozar
Copy link
Member

@svanderburg how is the new code performance comparing to previous?

@FlorentBecker
Copy link
Contributor

This seems to be fixed (texlive is now at the top of that listing).

@globin
Copy link
Member

globin commented Feb 20, 2017

Yep, looks fine

@globin globin closed this as completed Feb 20, 2017
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

No branches or pull requests

4 participants