[Rpm-maint] Feature request: Improved speed for 'rpm -qa'

Axel Liljencrantz liljencrantz at gmail.com
Wed Dec 20 16:54:22 UTC 2006


On 12/20/06, Michael Schroeder <mls at suse.de> wrote:
> On Tue, Dec 19, 2006 at 07:29:09PM +0100, Axel Liljencrantz wrote:
> > Even on my 300 MHz system, it only takes about 0.02 seconds. Is there
> > any chance that regular rpm could be made this fast, or is this too
> > much of a hack to include there? I don't think that bundling a special
> > command for querying the rpm database together with a general purpose
> > OS agnostic commandline shell is the proper way to do this...
>
> Well, the program is for a very special case:
>
> - No digest/signature checking
> - --qf '%{NAME}\n'
>
> So I don't know if patching rpm for this case is really useful.

It would be very useful since it is the only way to acess the rpm
database that has been demonstrated to work and is fast enough for
performing tab completions. In my opinion, that is a valid use case,
and rpm is currently _far_ to slow for that to work well, even with no
digest/signature checking.

Another option might be to simply optimize the current method to make
it fast enough. That would have the added advantage that one would get
acess to the 'summary' field as well, meaning that relevant
descriptions could be provided for every package.

>
> > By the way, why is this a hack? Is the index not updated when an entry
> > is removed or something? If not, indexes are there to be used!
>
> No, it's a hack because it assumes that the Name Index is in
> BerkeleyDB DB_HASH format, while it actually can be configured
> in /usr/lib/rpm/macros to be something else.

Ok, then it is a hack. But it might be a hack that makes sense to add,
in order to get fast  tab completions.

>
> > I did a comparison, and on my systems the only difference in output
> > between your command and 'rpm -qa' is that with your command, packages
> > that are installed in multiple versions are only printed once,
>
> This can easily be fixed.

Good.

>
> > and that package version numbers are not printed.
>
> That can't be helped. The program is fast because it doesn't need
> to read the complete "Packages" database. Reading just the name index
> doesn't give you the package versions.

Well, one could simply add checks and only use your 'magical fast
path' if --qf '%{NAME}\n' --nodigest --nosignature has been specified.
Works for me. That is one option.

The are two other options I can see:

Do nothing. (who cares about the commandline anyway - use pup or synaptic)

Do something clever with rpm to make real searches fast. If it isn't
done already, one could special case searches on package names of the
type 'alsa*' to perform an indexed search. I don't know how clever RPM
currently is in these situations, but my experience of databases tells
me that an indexed search on a ~30 MB database should be
instantaneous. The fact that rpm takes about 13 seconds even with
digest and signature checking off tells me that something suboptimal
is happening.

> Cheers,
>   Michael.
>
> --
> Michael Schroeder                                   mls at suse.de
> main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}
>

-- 
Axel



More information about the Rpm-maint mailing list