[pacman-dev] pacman -Qs first-run performance

Philipp hollunder at lavabit.com
Thu Sep 1 13:33:13 EDT 2011

Hi there,
pacman works very well for me, with one exception: searching for
installed packages. For me a -Ss takes about 5 seconds, a -Qs 25
seconds. I also noticed that this seems to be true for the first search
run only, the following ones are less than a second, no matter whether
it's a repo or local search. But if you want to just quickly find out a
thing, 25 seconds or so is a long time.

Anyway, I had a very brief look at the code and am far from
understanding it, but I think libalpm/db.c handles the search, the
package names, descriptions, etc. are stored in a linked list of
structs, the whole thing is cached in memory only and regex wizardry
is used for the search. If that's true, the bottleneck I experience is
the caching.

5 seconds for -Ss is acceptable for me, but I wonder whether there's a
reasonably easy way to improve the 25 seconds of -Qs.

My knowledge of pacman internals is non-existant and my C skills are
minimal, so I don't think I can be a lot of help with this one, but
maybe there's something else I can be of help with instead.

Best regards,

More information about the pacman-dev mailing list