summaryrefslogtreecommitdiff
path: root/lib/libalpm/cache.c
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-01-11 17:44:39 +0000
committerAaron Griffin <aaron@archlinux.org>2007-01-11 17:44:39 +0000
commit2a457c531978dc59b38b4bdbcc22dc3d8bdecbb6 (patch)
treea069680ce28623ee96ed030924e41471cc9f292d /lib/libalpm/cache.c
parent2ae56f4bc9cf3b155f009de601a8aa23a407ce4e (diff)
downloadpacman-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.c5
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);
}