From: Michael Schroeder Date: Mon, 18 May 2015 12:40:18 +0000 (+0200) Subject: Reduce the number if identical conflict rules X-Git-Tag: 0.6.11~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bbeceaad77a0940a2f1e5121c59328353c9a12a;p=thirdparty%2Flibsolv.git Reduce the number if identical conflict rules reduces memory usage and speeds up rule creation a bit. --- diff --git a/src/rules.c b/src/rules.c index 8a877d99..1b256272 100644 --- a/src/rules.c +++ b/src/rules.c @@ -931,7 +931,16 @@ solver_addpkgrulesforsolvable(Solver *solv, Solvable *s, Map *m) if (p == SYSTEMSOLVABLE) p = 0; if (s->name == ps->name) - addpkgrule(solv, -n, -p, 0, SOLVER_RULE_PKG_SAME_NAME, 0); + { + /* optimization: do not add the same-name conflict rule if it was + * already added when we looket at the other package. + * (this assumes pool_colormatch is symmetric) */ + if (p && m && ps->repo != installed && MAPTST(m, p) && + (ps->arch != ARCH_SRC && ps->arch != ARCH_NOSRC) && + !(solv->multiversion.size && MAPTST(&solv->multiversion, p))) + continue; + addpkgrule(solv, -n, -p, 0, SOLVER_RULE_PKG_SAME_NAME, 0); + } else addpkgrule(solv, -n, -p, 0, SOLVER_RULE_PKG_IMPLICIT_OBSOLETES, s->name); }