[bitbake-devel] [PATCH] codeparser: Small optimisation to stop repeated hash() calls
Richard Purdie
richard.purdie at linuxfoundation.org
Fri Jun 3 12:35:32 UTC 2016
No functionality change, just avoids function call overhead in a
function which loops heavily.
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py
index 00551ba..25938d6 100644
--- a/bitbake/lib/bb/codeparser.py
+++ b/bitbake/lib/bb/codeparser.py
@@ -69,9 +69,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()
More information about the bitbake-devel
mailing list