[pacman-dev] pacman cold caches performance, too much stat()ing

Dimitrios Apostolou jimis at gmx.net
Fri Dec 11 18:12:16 EST 2009

Hello list,

I have been investigating the slow performance of pacman regarding the 
cold caches scenario and I'm trying to write some proof of concept code 
that improves things a lot for some cases. However I need your help 
regarding some facts I might have misunderstood, and any pointers to the 
source code you also give me would also help a lot. I wouldn't like to 
lose time changing stuff that would break current functionality. 
So here are some first questions that come to mind, just by using strace:

When doing "pacman -Q blah" I can see that besides the getdents() 
syscalls in /var/lib/pacman/local (probably caused by readdir()), there 
are also stat() and access() calls for every single subdirectory. Why are 
the last ones necessary? Isn't readdir enough?

The same goes when doing "pacman -S blah". But in that case it stat()'s 
both 'local' and 'sync' directories, so worst case is really bad, it will 
stat() all contents of local, core, extra and community...

In the case of "pacman -S" I measured that a great deal of time goes also 
to reading the "depends" files of all packages in local, please enlighten 
me what this is for. I have thought of a new way to store dependencies 
that should improve things, but I should first be sure it doesn't break 
anything and get some measurements myself.

Thanks in advance,

P.S. Is there some option --pretend I might have missed? What I need is to 
get exactly the same actions of "pacman -S blah" or "pacman -Su" until the 
Y/N prompt, as non-root user.

More information about the pacman-dev mailing list