[Yum-devel] [PATCH] Call repo.__hash__() less.

James Antill james at fedoraproject.org
Thu Jan 28 23:23:35 UTC 2010


On Thu, 2010-01-28 at 23:48 +0200, Ville Skyttä wrote:
> On my (typicalish) Fedora 11 box, brings down number of those calls in
> a check-update run from ~146k to ~27k and speeds it up by ~7%.

 What about just changing Repository.__hash__ to something like:

    def __hash__(self):
        if self.__cached_hash is None:
            self.__cached_hash = hash(self.id)
        return self.__cached_hash

...with the obvious "self.__cached_hash = None" in __init__?



More information about the Yum-devel mailing list