NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.32k stars 1.49k forks source link

Poor performance of `nix build --debugger` #10796

Open kjeremy opened 4 months ago

kjeremy commented 4 months ago

Describe the bug

Adding --debugger to an invocation of nix build adds many minutes to a build. From the order of 30 seconds without the option to over 20 minutes on one of my flakes.

Steps To Reproduce

nix build .#blah --debugger

Expected behavior

I would expect that performance would be similar to a build without --debugger.

nix-env (Nix) 2.22.1

Additional context

Add any other context about the problem here.

Priorities

Add :+1: to issues you find important.

fricklerhandwerk commented 4 months ago

Triaged in Nix maintainers meeting:

@kjeremy could you please provide more detailed reproduction steps, it may pertain to your code.

nixos-discourse commented 4 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2024-05-29-nix-team-meeting-minutes-148/46195/1

kjeremy commented 4 months ago

@fricklerhandwerk That wouldn't surprise me. We have a flake that builds 60ish proprietary native packages and about 20+ cross-compiled nixos systems. I can't distribute any of it but I'll try to come up with some kind of representative example.

kjeremy commented 2 months ago
time nix run .#rosPackages.noetic.mrak_test_results_coverage --debug

gives

real 0m13.060s user 0m5.782s sys 0m1.896s

With --debugger

I'm running with --debugger --debug and noticing that the same things are being instantiated multiple times including the following two that I happened to Ctrl+C out of.

performing daemon worker op: 7
instantiated 'glibc-2.39.tar.xz' -> '/nix/store/gxv8zyycd4g400h51gfzpg0isk3b7qqd-glibc-2.39.tar.xz.drv'
performing daemon worker op: 7
instantiated 'glibc-2.39-52' -> '/nix/store/1whh7vxmcz14dym0h9453hpiqcw7lkcf-glibc-2.39-52.drv'

error: interrupted by the user

real    4m29.427s
user    3m42.872s
sys 0m21.521s