diff options
author | Aaron Griffin <aaron@archlinux.org> | 2007-01-11 18:44:39 +0100 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2007-01-11 18:44:39 +0100 |
commit | 2a457c531978dc59b38b4bdbcc22dc3d8bdecbb6 (patch) | |
tree | a069680ce28623ee96ed030924e41471cc9f292d /lib/libalpm/cache.c | |
parent | 2ae56f4bc9cf3b155f009de601a8aa23a407ce4e (diff) | |
download | pacman-2a457c531978dc59b38b4bdbcc22dc3d8bdecbb6.tar.gz pacman-2a457c531978dc59b38b4bdbcc22dc3d8bdecbb6.tar.xz |
* Jürgen Hötzel <juergen@hoetzel.info>
_alpm_db_load_pkgcache: use mergesort to improve performance
Diffstat (limited to 'lib/libalpm/cache.c')
-rw-r--r-- | lib/libalpm/cache.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c index ccba3bd6..6aa517cf 100644 --- a/lib/libalpm/cache.c +++ b/lib/libalpm/cache.c @@ -44,6 +44,7 @@ int _alpm_db_load_pkgcache(pmdb_t *db, unsigned char infolevel) { pmpkg_t *info; + int count = 0; /* The group cache needs INFRQ_DESC as well */ /*unsigned char infolevel = INFRQ_DEPENDS | INFRQ_DESC;*/ @@ -61,9 +62,11 @@ int _alpm_db_load_pkgcache(pmdb_t *db, unsigned char infolevel) info->origin = PKG_FROM_CACHE; info->data = db; /* add to the collection */ - db->pkgcache = _alpm_list_add_sorted(db->pkgcache, info, _alpm_pkg_cmp); + db->pkgcache = _alpm_list_add(db->pkgcache, info); + count++; } + db->pkgcache = _alpm_list_msort(db->pkgcache, count, _alpm_pkg_cmp); return(0); } |