Bug#139838: dpkg: performance problem - package database hash size too small
On Mon, Mar 25, 2002 at 05:47:22PM +0100, Wichert Akkerman wrote:
> Previously Colin Watson wrote:
> > Making the hash larger than the number of items it's going to have to
> > contain does seem like an "obviously correct" optimization though.
>
> Not necessarily since iirc the hash is only used to build the linked
> lists and not accessed after initialization.
It seems to iterate through whatever hash bin is in use every time,
doing a strcasecmp() against each key. The cost of all the strcasecmp()s
is how I originally noticed this.
struct pkginfo *findpackage(const char *inname) {
[...]
pointerp= bins + (hash(name) & (BINS-1));
while (*pointerp && strcasecmp((*pointerp)->name,name))
pointerp= &(*pointerp)->next;
--
Colin Watson [cjwatson@flatline.org.uk]
--
To UNSUBSCRIBE, email to debian-dpkg-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: