[pacman-dev] [PATCH 0/4] Package list find performance improvements

Dave Reisner d at falconindy.com
Tue Dec 14 18:00:32 EST 2010


On Tue, Dec 14, 2010 at 12:46:15PM -0600, Dan McGee wrote:
> This series of patches makes finding a package in our linked list
> implementation a whole lot faster, if that search is using the standard
> _alpm_pkg_find, which nearly all are (after the first patch).
> 
> It does this by adding a hash function to util.c which is nothing too
> complicated and named after a publicly available algorithm. When packages are
> created, we fill in this hash value as soon as the pkgname is read. Finally,
> the _alpm_pkg_find function is rewritten to take advantage of this field,
> avoiding repeated strcmp() calls and only falling back to that if a hash is not
> available and to verify the hash value was not some sort of collision.
> 
> Performance figures and numbers are available in the last patch. This actually
> speeds up operations by nearly 33%, so this is not a total waste of time to
> consider. :) Review and questions/comments/concerns welcome!
> 
> -Dan

Well, nothing's broken so far. Installed a few new packages with -U and
ran an -Syu with no trouble. Speed improvement is there, but nothing
significant on my smallish database of 500 packages.

These patches are boring -- they just work. I thought you had to be
brave to use pacman-git. Stop boring me, Dan.

(very nice work though)

dave


More information about the pacman-dev mailing list