From: Marat Radchenko Date: Fri, 20 May 2011 04:25:17 +0000 (+0400) Subject: Package: precalculate _hash_key X-Git-Tag: v2.1.9.50~73 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c8f48112ca556b872851bb2a5f30695865db0093;p=portage.git Package: precalculate _hash_key This eliminates an expensive getattr call in _get_hash_key(), which greatly improves depgraph performance on a weak ARM cpu. --- diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index f11da6ee5..d7efbf2ae 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -73,6 +73,9 @@ class Package(Task): else: self.operation = "merge" + self._hash_key = \ + (self.type_name, self.root, self.cpv, self.operation) + def _validate_deps(self): """ Validate deps. This does not trigger USE calculation since that @@ -405,10 +408,6 @@ class Package(Task): return missing_iuse def _get_hash_key(self): - hash_key = getattr(self, "_hash_key", None) - if hash_key is None: - self._hash_key = \ - (self.type_name, self.root, self.cpv, self.operation) return self._hash_key def __lt__(self, other):