Performance of exportReferencesGraph/pkgs.closureInfo in Lix over time #1180

Open
opened 2026-04-09 11:10:36 +00:00 by qyriad · 0 comments
Owner

We recently noticed pkgs.closureInfo having much worse performance with daemon stores than local stores, and also found that this wasn't the case in Lix 2.90.0, so we dug deeper. We benchmarked pkgs.closureInfo (with a somewhat large but arbitrary set of packages) with a local store across Lix releases:

Command Mean [s] Min [s] Max [s] Relative
lix-2.90.0 26.701 ± 0.521 25.976 27.661 1.01 ± 0.03
lix-2.91.0 26.359 ± 0.402 25.886 26.916 1.00
lix-2.91.3 26.853 ± 0.331 26.268 27.237 1.02 ± 0.02
lix-2.92.3 29.236 ± 0.539 28.350 30.045 1.11 ± 0.03
lix-2.93.0 52.845 ± 1.076 50.890 54.069 2.00 ± 0.05
lix-2.93.3 52.509 ± 0.876 50.944 53.482 1.99 ± 0.05
lix-2.94.0 38.055 ± 0.517 37.155 38.837 1.44 ± 0.03
lix-2.95.1 38.487 ± 0.527 37.736 39.308 1.46 ± 0.03
lix-main 39.213 ± 0.480 38.241 39.816 1.49 ± 0.03

Generated with:

$ hyperfine \
  --parameter-list lix "lix-2.90.0,lix-2.91.0,lix-2.91.3,lix-2.92.3,lix-2.93.0,lix-2.93.3,lix-2.94.0,lix-2.95.1,lix-main" \
  "./result-{lix}/bin/nix --option use-cgroups false --option auto-allocate-uids false --no-link --store ./store-tmp -f ./closure-info.nix closureInfo --rebuild" \
  --setup "./result-{lix}/bin/nix --option use-cgroups false --option auto-allocate-uids false --no-link --store ./store-tmp -f ./closure-info.nix closureInfo"

Contents of closure-info.nix:
{
  pkgs ? import <nixpkgs> { },
  lib ? pkgs.lib,
}: lib.fix (self: {
  closureInfo = pkgs.closureInfo {
    rootPaths = [
      self.root.drvPath
    ];
  };

  nixos = import "${pkgs.path}/nixos" {
    configuration = { pkgs, ... }: {
      nixpkgs.hostPlatform = "x86_64-linux";
      system.stateVersion = "26.05";

      boot.loader.systemd-boot.enable = true;
      fileSystems."/" = {
        device = "/dev/sda";
        fsType = "ext4";
      };

      environment.systemPackages = with pkgs; ([
        wl-clipboard
        waypipe
        lldb
        musescore
        rustc
        rust-analyzer
        cargo-clone
        colmena
        nixfmt
        rr
        quickemu
        gh
        systemd-lsp
        alacritty
        ghostty
        mpv
        ffmpeg-full
        pulseview
        krita
        aegisub
        firefox
        curl
        tesseract
        kdePackages.kcalc
        kdePackages.kwin
        perl
        which
        strace
        kdePackages.plasma-desktop
        zstd
        weston
        llvmPackages.lld
        llvmPackages.libcxx
        pkgsLLVM.hello
      ]);
    };
  };

  root = self.nixos.config.system.build.vm;
})
We recently noticed `pkgs.closureInfo` having much worse performance with daemon stores than local stores, and also found that this wasn't the case in Lix 2.90.0, so we dug deeper. We benchmarked `pkgs.closureInfo` (with a somewhat large but arbitrary set of packages) with a **local** store across Lix releases: | Command | Mean [s] | Min [s] | Max [s] | Relative | |:---|---:|---:|---:|---:| | lix-2.90.0 | 26.701 ± 0.521 | 25.976 | 27.661 | 1.01 ± 0.03 | | lix-2.91.0 | 26.359 ± 0.402 | 25.886 | 26.916 | 1.00 | | lix-2.91.3 | 26.853 ± 0.331 | 26.268 | 27.237 | 1.02 ± 0.02 | | lix-2.92.3 | 29.236 ± 0.539 | 28.350 | 30.045 | 1.11 ± 0.03 | | lix-2.93.0 | 52.845 ± 1.076 | 50.890 | 54.069 | 2.00 ± 0.05 | | lix-2.93.3 | 52.509 ± 0.876 | 50.944 | 53.482 | 1.99 ± 0.05 | | lix-2.94.0 | 38.055 ± 0.517 | 37.155 | 38.837 | 1.44 ± 0.03 | | lix-2.95.1 | 38.487 ± 0.527 | 37.736 | 39.308 | 1.46 ± 0.03 | | lix-main | 39.213 ± 0.480 | 38.241 | 39.816 | 1.49 ± 0.03 | Generated with: ```bash $ hyperfine \ --parameter-list lix "lix-2.90.0,lix-2.91.0,lix-2.91.3,lix-2.92.3,lix-2.93.0,lix-2.93.3,lix-2.94.0,lix-2.95.1,lix-main" \ "./result-{lix}/bin/nix --option use-cgroups false --option auto-allocate-uids false --no-link --store ./store-tmp -f ./closure-info.nix closureInfo --rebuild" \ --setup "./result-{lix}/bin/nix --option use-cgroups false --option auto-allocate-uids false --no-link --store ./store-tmp -f ./closure-info.nix closureInfo" ``` <hr> <details> <summary>Contents of <code>closure-info.nix</code>:</summary> ```nix { pkgs ? import <nixpkgs> { }, lib ? pkgs.lib, }: lib.fix (self: { closureInfo = pkgs.closureInfo { rootPaths = [ self.root.drvPath ]; }; nixos = import "${pkgs.path}/nixos" { configuration = { pkgs, ... }: { nixpkgs.hostPlatform = "x86_64-linux"; system.stateVersion = "26.05"; boot.loader.systemd-boot.enable = true; fileSystems."/" = { device = "/dev/sda"; fsType = "ext4"; }; environment.systemPackages = with pkgs; ([ wl-clipboard waypipe lldb musescore rustc rust-analyzer cargo-clone colmena nixfmt rr quickemu gh systemd-lsp alacritty ghostty mpv ffmpeg-full pulseview krita aegisub firefox curl tesseract kdePackages.kcalc kdePackages.kwin perl which strace kdePackages.plasma-desktop zstd weston llvmPackages.lld llvmPackages.libcxx pkgsLLVM.hello ]); }; }; root = self.nixos.config.system.build.vm; }) ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lix-project/lix#1180
No description provided.