From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-commits+bounces-346228-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1QNHiY-0000Kp-7q
	for garchives@archives.gentoo.org; Fri, 20 May 2011 04:53:42 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id BB88A1C02E;
	Fri, 20 May 2011 04:53:33 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id 8DABB1C02E
	for <gentoo-commits@lists.gentoo.org>; Fri, 20 May 2011 04:53:33 +0000 (UTC)
Received: from pelican.gentoo.org (unknown [66.219.59.40])
	(using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 25E301B400D
	for <gentoo-commits@lists.gentoo.org>; Fri, 20 May 2011 04:53:33 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id 654EE8001E
	for <gentoo-commits@lists.gentoo.org>; Fri, 20 May 2011 04:53:32 +0000 (UTC)
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org>
Message-ID: <8e0189a2af9e5e746070c9401be04381a91a3760.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/
X-VCS-Repository: proj/portage
X-VCS-Files: pym/_emerge/Package.py
X-VCS-Directories: pym/_emerge/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: 8e0189a2af9e5e746070c9401be04381a91a3760
Date: Fri, 20 May 2011 04:53:32 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: 
X-Archives-Hash: 2aceb857786d751e5065118cde83175a

commit:     8e0189a2af9e5e746070c9401be04381a91a3760
Author:     Marat Radchenko <marat <AT> slonopotamus <DOT> org>
AuthorDate: Fri May 20 04:25:17 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri May 20 04:52:28 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a=
=3Dcommit;h=3D8e0189a2

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 |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index 2dfcc85..12fa537 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -81,6 +81,15 @@ class Package(Task):
 			else:
 				self.operation =3D "merge"
=20
+		# For installed (and binary) packages we don't care for the repo
+		# when it comes to hashing, because there can only be one cpv.
+		# So overwrite the repo_key with type_name.
+		repo_key =3D self.metadata.get('repository')
+		if self.type_name !=3D 'ebuild':
+			repo_key =3D self.type_name
+		self._hash_key =3D \
+			(self.type_name, self.root, self.cpv, self.operation, repo_key)
+
 	def _validate_deps(self):
 		"""
 		Validate deps. This does not trigger USE calculation since that
@@ -266,7 +275,6 @@ class Package(Task):
 			self.cpv, self.metadata)
 		return pmask is not None
=20
-
 	def _metadata_exception(self, k, e):
=20
 		# For unicode safety with python-2.x we need to avoid
@@ -453,16 +461,6 @@ class Package(Task):
 			return missing_iuse
=20
 	def _get_hash_key(self):
-		hash_key =3D getattr(self, "_hash_key", None)
-		if hash_key is None:
-			# For installed (and binary) packages we don't care for the repo
-			# when it comes to hashing, because there can only be one cpv.
-			# So overwrite the repo_key with type_name.
-			repo_key =3D self.metadata.get('repository')
-			if self.type_name !=3D 'ebuild':
-				repo_key =3D self.type_name
-			self._hash_key =3D \
-				(self.type_name, self.root, self.cpv, self.operation, repo_key)
 		return self._hash_key
=20
 	def __len__(self):