[gnome-continuous-yocto/gnomeostree-3.28-rocko: 720/8267] bitbake: codeparser: Small optimisation to stop repeated hash() calls
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 720/8267] bitbake: codeparser: Small optimisation to stop repeated hash() calls
- Date: Sat, 16 Dec 2017 20:49:20 +0000 (UTC)
commit 5f2facfc1dd80d28b2734bc7592e4b7c73cdb828
Author: Richard Purdie <richard purdie linuxfoundation org>
Date: Fri Jun 3 13:35:32 2016 +0100
bitbake: codeparser: Small optimisation to stop repeated hash() calls
No functionality change, just avoids function call overhead in a
function which loops heavily.
(Bitbake rev: 633c0c19f87a92497a7e9771811cdc953e1b7047)
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
bitbake/lib/bb/codeparser.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py
index b1d067a..6ed2ade 100644
--- a/bitbake/lib/bb/codeparser.py
+++ b/bitbake/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()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]