summaryrefslogtreecommitdiffstats
path: root/lib/bb/codeparser.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-03 13:35:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-03 13:47:15 +0100
commit633c0c19f87a92497a7e9771811cdc953e1b7047 (patch)
treeec3241e5b4885e0dff6d9a44a7119cd1e496e085 /lib/bb/codeparser.py
parent17ff08d225a8fa7faffd683c028369574954fba9 (diff)
downloadbitbake-contrib-633c0c19f87a92497a7e9771811cdc953e1b7047.tar.gz
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@linuxfoundation.org>
Diffstat (limited to 'lib/bb/codeparser.py')
-rw-r--r--lib/bb/codeparser.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/bb/codeparser.py b/lib/bb/codeparser.py
index b1d067a2f..6ed2adeed 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()