summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormorganamilo <morganamilo@gmail.com>2019-09-08 23:45:29 +0200
committerAllan McRae <allan@archlinux.org>2019-10-07 06:27:09 +0200
commit8f89e509d2f3d369cb5adb30dd85713ff1c5305c (patch)
treeffaeefd161ef6e12c1b4ff4ea52fa12dc135313f /src
parentf2442bc2e9d41a68b9965c272794600836c36b8b (diff)
downloadpacman-8f89e509d2f3d369cb5adb30dd85713ff1c5305c.tar.gz
pacman-8f89e509d2f3d369cb5adb30dd85713ff1c5305c.tar.xz
pacman: speed up deptest
Try and find an exact match via pkgcache before iterating the entire localdb. Gives a noticeable speed up for exact matches e.g. `pacman -T zlib` Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/deptest.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c
index 597eee42..76bf223e 100644
--- a/src/pacman/deptest.c
+++ b/src/pacman/deptest.c
@@ -32,11 +32,13 @@ int pacman_deptest(alpm_list_t *targets)
alpm_list_t *i;
alpm_list_t *deps = NULL;
alpm_db_t *localdb = alpm_get_localdb(config->handle);
+ alpm_list_t *pkgcache = alpm_db_get_pkgcache(localdb);
for(i = targets; i; i = alpm_list_next(i)) {
char *target = i->data;
- if(!alpm_find_satisfier(alpm_db_get_pkgcache(localdb), target)) {
+ if(!alpm_db_get_pkg(localdb, target) &&
+ !alpm_find_satisfier(pkgcache, target)) {
deps = alpm_list_add(deps, target);
}
}