[Nix-dev] Why Nix-0.16 so hungry on ressources (mem + cpu) ?

Lluís Batlle i Rossell viriketo at gmail.com
Mon Oct 31 18:51:07 CET 2011


On Mon, Oct 31, 2011 at 05:45:37PM +0100, Eelco Dolstra wrote:
> On 10/30/2011 10:55 PM, Lluís Batlle i Rossell wrote:
> 
> > On the sheevaplug, 512MB of physical RAM, and the same amount of swap:
> > 7.88user 0.71system 0:09.86elapsed 87%CPU (0avgtext+0avgdata 617568maxresident)k
> > 0inputs+0outputs (4major+41841minor)pagefaults 0swaps
> > 
> > I think Eelco thinks there is a bug in 'time' about the remort of memory,
> > showing something 4-times bigger or so on some systems. Maybe we have something
> > bad about page-size in headers/kernel?
> 
> I've looked into this and it turns out to be a bug in ‘time’.  I've applied a fix.
> 
> FWIW, here are my stats (on a 64-bit machine):
> 
> $ command time nix-env -i hello --dry-run
> 0.72user 0.21system 0:00.96elapsed 97%CPU (0avgtext+0avgdata 352008maxresident)k
> 
> $ GC_INITIAL_HEAP_SIZE=100000 command time nix-env -i hello --dry-run
> 1.46user 0.08system 0:01.57elapsed 98%CPU (0avgtext+0avgdata 104540maxresident)k
> 
> $ command time nix-env -f ~/Dev/nixpkgs -iA hello --dry-run
> 0.07user 0.01system 0:00.10elapsed 82%CPU (0avgtext+0avgdata 13388maxresident)k
> 
> $ GC_INITIAL_HEAP_SIZE=100000 command time nix-env -f ~/Dev/nixpkgs -iA hello
> --dry-run
> 0.08user 0.01system 0:00.11elapsed 81%CPU (0avgtext+0avgdata 12736maxresident)k
> 
> $ command time nix-instantiate /etc/nixos/nixos -A system --readonly-mode
> 1.00user 0.10system 0:01.11elapsed 99%CPU (0avgtext+0avgdata 243636maxresident)k
> 
> $ GC_INITIAL_HEAP_SIZE=100000 command time nix-instantiate /etc/nixos/nixos -A
> system --readonly-mode
> 1.34user 0.04system 0:01.39elapsed 99%CPU (0avgtext+0avgdata 64544maxresident)k
> 
> So NixOS system evaluation can run in 63 MiB.

It depends on having X or not, etc. And a bad guess on the initial heap size may
be bad too.

And how much of that memory can be freed before building? I think it's kept until
the end of the build, right? Maybe not.

Regards,
Lluís.


More information about the nix-dev mailing list