[oe-commits] [bitbake] 01/02: codeparser: Small optimisation to stop repeated hash() calls
git at git.openembedded.org
git at git.openembedded.org
Fri Jun 3 12:49:42 UTC 2016
rpurdie pushed a commit to branch master
in repository bitbake.
commit 633c0c19f87a92497a7e9771811cdc953e1b7047
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Fri Jun 3 13:35:32 2016 +0100
codeparser: Small optimisation to stop repeated hash() calls
No functionality change, just avoids function call overhead in a
function which loops heavily.
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/bb/codeparser.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/bb/codeparser.py b/lib/bb/codeparser.py
index b1d067a..6ed2ade 100644
--- a/lib/bb/codeparser.py
+++ b/lib/bb/codeparser.py
@@ -65,9 +65,10 @@ class SetCache(object):
for i in items:
new.append(sys.intern(i))
s = frozenset(new)
- if hash(s) in self.setcache:
- return self.setcache[hash(s)]
- self.setcache[hash(s)] = s
+ h = hash(s)
+ if h in self.setcache:
+ return self.setcache[h]
+ self.setcache[h] = s
return s
codecache = SetCache()
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list