nix-output-monitor
nix-output-monitor copied to clipboard
Big slowdown with very big build logs
With this derivation:
{ pkgs ? (import <nixpkgs> {}) }:
pkgs.stdenv.mkDerivation {
name = "robot-that-screams";
buildCommand = ''
for _ in {0..1000000}; do
echo AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
done
'';
}
nix-build runs in under 10 seconds:
nix-build -v --log-format internal-json &> /dev/null 1.89s user 0.79s system 33% cpu 7.898 total
nom-build takes minutes (exact time TBC)
nom-build &> /dev/null 4344.87s user 1614.41s system 114% cpu 1:26:59.89 total
Some more ad-hoc testing: 10k lines finishes in 3 seconds, 100k lines finishes in under a minute, 200k lines takes 8 minutes, which sounds ... cubic, possibly?
Thank you! That's excellent debugging data. I have already fixed a number of space leaks a few weeks ago. So maybe this is already better on main.
I will get to this, when I have the time.
I just tried 791e8e and it's much better - 25 seconds for the initial 1 million lines test. This is still considerably slower than nix-build's 8 seconds, but a lot more usable than multiple hours. Maybe you could cut a new release with the current changes?
Yeah, I probably should. Sadly there are a few modifications in main which I consider experimental and don't want to release into the wild without polishing them.
I have published a new release and opened a PR against Nixpkgs in https://github.com/NixOS/nixpkgs/pull/231922.
I will leave this issue open until I have debugged the remaining performance difference between nom-build and nix-build.
I still haven’t profiled this issue exactly, but one obvious problem came to mind, which I have fixed on main, reducing test time by another 50%.
I quite consciously had decided, that I will never need to buffer a lot of output at the same time. Don’t ask me why I did that, but it’s at least partially fixed now.