From c8f48112ca556b872851bb2a5f30695865db0093 Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Fri, 20 May 2011 08:25:17 +0400 Subject: [PATCH] Package: precalculate _hash_key This eliminates an expensive getattr call in _get_hash_key(), which greatly improves depgraph performance on a weak ARM cpu. --- pym/_emerge/Package.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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): -- 2.26.2