mirror of
https://github.com/NixOS/nix.git
synced 2025-11-13 05:56:03 +01:00
Before the change garbage collector was not considering
`.drv` and outputs as alive even if configuration says otherwise.
As a result `nix store gc --dry-run` could visit (and parse)
`.drv` files multiple times (worst case it's quadratic).
It happens because `alive` set was populating only runtime closure
without regard for actual configuration. The change fixes it.
Benchmark: my system has about 139MB, 40K `.drv` files.
Performance before the change:
$ time nix store gc --dry-run
real 4m22,148s
Performance after the change:
$ time nix store gc --dry-run
real 0m14,178s
|
||
|---|---|---|
| .. | ||
| build-remote | ||
| libcmd | ||
| libexpr | ||
| libfetchers | ||
| libmain | ||
| libstore | ||
| libutil | ||
| nix | ||
| nix-build | ||
| nix-channel | ||
| nix-collect-garbage | ||
| nix-copy-closure | ||
| nix-env | ||
| nix-instantiate | ||
| nix-store | ||
| resolve-system-dependencies | ||
| toml11 | ||