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

Denis A. Altoé Falqueto denisfalqueto at gmail.com
Thu Sep 1 14:19:21 EDT 2011


On Thu, Sep 1, 2011 at 3:14 PM, Denis A. Altoé Falqueto
<denisfalqueto at gmail.com> wrote:
> On Thu, Sep 1, 2011 at 2:57 PM, Philipp Überbacher
> <hollunder at lavabit.com> wrote:
>> Excerpts from Karol Blazewicz's message of 2011-09-01 19:38:32 +0200:
>>> On Thu, Sep 1, 2011 at 7:33 PM, Philipp <hollunder at lavabit.com> wrote:
>>> > 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,
>>> > Philipp
>>> >
>>> >
>>> >
>>>
>>> I'm getting 10s -Qs first-time searches, what harddrive are you using??
>>
>> It's a normal laptop HD, Hitachi HTS54321, 160GB, 5400 rpm.
>> It's really kind of weird that the web search takes longer than the
>> local search, intuition dictates it should be the other way around.
>
> It is not a web search, though. -Ss searches in /var/lib/pacman/sync
> and -Qs searches in /var/lib/pacman/local. Both are limited by the
> same I/O bus. Theoretically, you'll have less packages installed than
> not installed, so the size of /var/lib/pacman/local should be smaller
> than /var/lib/pacman/sync. Could you compare the sizes of those two
> directories?

Replying to myself.... /var/lib/pacman/sync is using tar.gz's to store
the database repositories, so what I said is not true anymore (it was
for old versions os pacman). /var/lib/pacman/sync is smaller than
/var/lib/pacman/local, because  local is made from lots of small
files.

Should have tested it before sending the email :)

-- 
A: Because it obfuscates the reading.
Q: Why is top posting so bad?

-------------------------------------------
Denis A. Altoe Falqueto
Linux user #524555
-------------------------------------------


More information about the pacman-dev mailing list