[Yum-devel] Re: [yum-cvs] 2 commits - yum/packages.py
seth vidal
skvidal at fedoraproject.org
Wed Dec 12 00:56:46 UTC 2007
On Tue, 2007-12-11 at 19:34 -0500, James Antill wrote:
> yum/packages.py | 30 ++++++++++++++++++++++++++++--
> 1 file changed, 28 insertions(+), 2 deletions(-)
>
> New commits:
> commit 616141b3a263097a6a3efac8d331b471aa6f8e5b
> Author: James Antill <james at and.org>
> Date: Tue Dec 11 19:34:37 2007 -0500
>
> Make parsePackages() faster for common case
>
> diff --git a/yum/packages.py b/yum/packages.py
> index add3afd..207ef37 100644
> --- a/yum/packages.py
> +++ b/yum/packages.py
> @@ -92,7 +92,26 @@ def parsePackages(pkgs, usercommands, casematch=0):
> return True
> return False
>
> - pkgdict = buildPkgRefDict(pkgs, bool(casematch))
> + # If we can match on only the name, do so as it uses much less CPU/RAM
> + # for the pkgdict. And most of the time poepl use: foo or foo*
> + name_only_match = True
> + for command in usercommands:
> + if command[-1] == '*': # Can still match on name only, for prefix
> + command = command[:-1]
> + if contains(command, "*,[]{}?.-"):
> + name_only_match = False
> + break
> +
> + if not name_only_match:
> + pkgdict = buildPkgRefDict(pkgs, bool(casematch))
> + else:
> + pkgdict = {}
> + for pkg in pkgs:
> + n = pkg.name
> + if not casematch:
> + n = n.lower()
> + pkgdict.setdefault(n, []).append(pkg)
> +
ugh - revert this. This heuristic will bite us on the ass.
Seriously, I don't know how much we're saving with this but it sure
can't be worth that much.
we have more than enough hacky heuristics in how pkgs are updated.
-sv
More information about the Yum-devel
mailing list