Skip to content

nix build -f. pkg1 ... pkg100 is 10x slower than a build with single expression #9724

@trofi

Description

@trofi

Describe the bug

I noticed the nix build -f. slowdown when did mass rebuilds locally worth of 3000 packages. I expected speedy build startup and instead had to wait minutes for a startup.

Steps To Reproduce

Prerequisite: build a list of first 100 packages in `nixkgs:

$ nix-instantiate --strict --eval --expr 'with import ./. {}; map (p: p.name) (lib.take 100 (lib.filter (p: let e = builtins.tryEval (lib.isDerivation p.value); in e.success && e.value) (lib.attrsToList pkgs)))'

[ "AMB-plugins" "ArchiSteamFarm" "AusweisApp2" "BeatSaberModManager" "CHOWTapeModel" "ChowCentaur" "ChowKick" "ChowPhaser" "CoinMP" "DisnixWebService" "EBTKS" "EmptyEpsilon" "FIL-plugins" "Fabric" "HentaiAtHome" "LAStools" "LASzip" "LASzip2" "LibreArp" "LibreArp-lv2" "Literate" "MACS2" "MIDIVisualizer" "MMA" "NSPlist" "OSCAR" "OVMF" "OVMFFull" "PageEdit" "PlistCpp" "QuadProgpp" "R" "SDL" "SDL2" "SDL2_gfx" "SDL2_image" "SDL2_image_2_0_5" "SDL2_mixer" "SDL2_mixer_2_0" "SDL2_net" "SDL2_sound" "SDL2_ttf" "SDL_Pango" "SDL_audiolib" "SDL_classic" "SDL_compat" "SDL_gfx" "SDL_gpu" "SDL_image" "SDL_mixer" "SDL_net" "SDL_sixel" "SDL_sound" "SDL_stretch" "SDL_ttf" "SP800-90B_EntropyAssessment" "SPAdes" "SkypeExport" "StormLib" "Sylk" "ViennaRNA" "Xaw3d" "_0verkill" "_0x" "_1oom" "_1password" "_1password-gui" "_1password-gui-beta" "_2048-cli" "_2048-cli-curses" "_2048-cli-terminal" "_2048-in-terminal" "_20kly" "_2bwm" "_3270font" "_389-ds-base" "_3llo" "_3mux" "_3proxy" "_4th" "_4ti2" "_5etools" "_6tunnel" "_7kaa" "_7zz" "_86Box" "_90secondportraits" "_915resolution" "_9base" "_9menu" "_9pfs" "_9ptls" "a2jmidid" "a2ps" "a4" "a4term" "a52dec" "aaa" "aaaaxy" "aacgain" ]

Good (a single expression build):

$ time NIXPKGS_ALLOW_UNFREE=1 nix build --impure --expr 'with import ./. {}; runCommand "foo" { buildInputs = [ AMB-plugins ArchiSteamFarm AusweisApp2 BeatSaberModManager CHOWTapeModel ChowCentaur ChowKick ChowPhaser CoinMP DisnixWebService EBTKS EmptyEpsilon FIL-plugins Fabric HentaiAtHome LAStools LASzip LASzip2 LibreArp LibreArp-lv2 Literate MACS2 MIDIVisualizer MMA NSPlist OSCAR OVMF OVMFFull PageEdit PlistCpp QuadProgpp R SDL SDL2 SDL2_gfx SDL2_image SDL2_image_2_0_5 SDL2_mixer SDL2_mixer_2_0 SDL2_net SDL2_sound SDL2_ttf SDL_Pango SDL_audiolib SDL_classic SDL_compat SDL_gfx SDL_gpu SDL_image SDL_mixer SDL_net SDL_sixel SDL_sound SDL_stretch SDL_ttf SP800-90B_EntropyAssessment SPAdes SkypeExport StormLib Sylk ViennaRNA Xaw3d _0verkill _0x _1oom _1password _1password-gui _1password-gui-beta _2048-cli _2048-cli-curses _2048-cli-terminal _2048-in-terminal _20kly _2bwm _3270font _389-ds-base _3llo _3mux _3proxy _4th _4ti2 _5etools _6tunnel _7kaa _7zz _86Box _90secondportraits _915resolution _9base _9menu _9pfs _9ptls a2jmidid a2ps a4 a4term a52dec aaa aaaaxy aacgain ]; } "touch $out"' --dry-run
...
real    0m3,481s
user    0m2,216s
sys     0m0,466s

Bad (nix build -f.):

$ time NIXPKGS_ALLOW_UNFREE=1 nix build -f. --no-link AMB-plugins ArchiSteamFarm AusweisApp2 BeatSaberModManager CHOWTapeModel ChowCentaur ChowKick ChowPhaser CoinMP DisnixWebService EBTKS EmptyEpsilon FIL-plugins Fabric HentaiAtHome LAStools LASzip LASzip2 LibreArp LibreArp-lv2 Literate MACS2 MIDIVisualizer MMA NSPlist OSCAR OVMF OVMFFull PageEdit PlistCpp QuadProgpp R SDL SDL2 SDL2_gfx SDL2_image SDL2_image_2_0_5 SDL2_mixer SDL2_mixer_2_0 SDL2_net SDL2_sound SDL2_ttf SDL_Pango SDL_audiolib SDL_classic SDL_compat SDL_gfx SDL_gpu SDL_image SDL_mixer SDL_net SDL_sixel SDL_sound SDL_stretch SDL_ttf SP800-90B_EntropyAssessment SPAdes SkypeExport StormLib Sylk ViennaRNA Xaw3d _0verkill _0x _1oom _1password _1password-gui _1password-gui-beta _2048-cli _2048-cli-curses _2048-cli-terminal _2048-in-terminal _20kly _2bwm _3270font _389-ds-base _3llo _3mux _3proxy _4th _4ti2 _5etools _6tunnel _7kaa _7zz _86Box _90secondportraits _915resolution _9base _9menu _9pfs _9ptls a2jmidid a2ps a4 a4term a52dec aaa aaaaxy aacgain --dry-run
...
real    0m31,570s
user    0m21,679s
sys     0m3,392s

30s vs 3s is a 10x slowdown.

Expected behavior

Ideally $ nix build -f. should work as fast as a single expression.

nix-env --version output: nix-env (Nix) 2.19.2

Priorities

Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions