codeparser: Small optimisation to stop repeated hash() calls
PATCH 1/1 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 <[email protected]>
bitbake/lib/bb/codeparser.py +4 -3
@@ -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()