[Nix-dev] Re: Performance impact of Nix

Eelco Dolstra e.dolstra at tudelft.nl
Mon Aug 3 16:33:14 CEST 2009


Marc Weber wrote:

> you're aware that the system caches directory contents?
> So if you run the same command a second time everything will be faster?

A nice trick for doing somewhat deterministic I/O measurements:

$ sync
$ echo 3 > /proc/sys/vm/drop_caches

This makes the kernel throw away the pagecache etc.

> I think the more important question is: I accesing
>   /EEEEEEEEEEEEEEEEEEEE-name
> 
> faster than
>   /nix/store/EEEEEEEEEEEEEEEEEEEEEEEEEE-name 
> or
>   /nix/store/a/b/c/d/e/f/EEEEEEEEEEEEEEEEEEEEEEEEEE-name 
> ?

The former should be faster on filesystems like ext3/ext4 with b-tree / hashed
directory indices.  If you don't have that, directory lookups will take O(n)
time, which is obviously bad if you have a large Nix store.  (On the other hand,
the OS is likely to cache the directory contents, so it will only be slow the
first time.)

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



More information about the nix-dev mailing list