[Nix-dev] Re: FOSDEM 2008 meeting

Eelco Dolstra e.dolstra at tudelft.nl
Tue Feb 12 11:20:28 CET 2008


Hi,

Ludovic Courtès wrote:

> ludo at gnu.org (Ludovic Courtès) writes:
> 
>> "nix-env -i" is indeed surprisingly slow---"surprisingly" because other
>> operations like `nix-build' don't seem to take that long...

It has gotten a lot slower over the last few months: it used to take 2 or 3 
seconds (provided that all the Nix expressions where in the disk cache - all the 
seek times for those small files add up), but now it's more like 10.  This is 
probably because some expensive computations are being done in Nix expressions 
(like the uniqList function) which might be done in a different way or turned 
into primops.

So we should do some profiling...

> Wild guess: "nix-env -i" has to read the *whole* Nix expression to get
> the `name' attributes (e.g., `all-packages.nix' plus all imported Nix
> expressions), while "nix-env -Ai" could in theory just read
> `all-packages.nix' and only lazily read the required imported Nix
> expressions.

Yes, exactly.  nix-env -i has to look at all packages to evaluate the name 
attribute, while nix-env -i -A (= nix-build) only evaluates what is necessary. 
nix-env -i -A also has the advantage that it's unambiguous wrt which package to 
install, so maybe we should make it the primary user interface ;-)

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list