* [PATCH] codeparser: Small optimisation to stop repeated hash() calls
@ 2016-06-03 12:35 Richard Purdie
0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2016-06-03 12:35 UTC (permalink / raw)
To: bitbake-devel
No functionality change, just avoids function call overhead in a
function which loops heavily.
Signed-off-by: Richard Purdie <richard.purdie@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()
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-06-03 12:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-03 12:35 [PATCH] codeparser: Small optimisation to stop repeated hash() calls Richard Purdie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.