summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-10 17:23:33 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-28 15:27:40 +0100
commitcc2a8ff5225e9fe987d8036970b2bf4293a13611 (patch)
tree61728fb75a8c92e9653e756abdbc82392efc8ebd /bitbake/lib/bb
parentfb3800178947e21899227e4ba4db4670b29231c7 (diff)
downloadpoky-cc2a8ff5225e9fe987d8036970b2bf4293a13611.tar.gz
bitbake/data_smart: Optimise the data store iterator
Since we're going to creat the seen set() anyway, we might as well use it directly. If we don't do this, we see thousands of function calls with associated overhead on profiles. (Bitbake rev: 9d43e3279895639ee4899df635f2546c7ee13737) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/data_smart.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 93c1b81aee..1fede8f01e 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -401,18 +401,20 @@ class DataSmart(MutableMapping):
401 yield key 401 yield key
402 402
403 def __iter__(self): 403 def __iter__(self):
404 seen = set() 404 def keylist(d):
405 def _keys(d): 405 klist = set()
406 for key in d:
407 if key == "_data":
408 continue
409 klist.add(key)
410
406 if "_data" in d: 411 if "_data" in d:
407 for key in _keys(d["_data"]): 412 klist |= keylist(d["_data"])
408 yield key
409 413
410 for key in d: 414 return klist
411 if key != "_data": 415
412 if not key in seen: 416 for k in keylist(self.dict):
413 seen.add(key) 417 yield k
414 yield key
415 return _keys(self.dict)
416 418
417 def __len__(self): 419 def __len__(self):
418 return len(frozenset(self)) 420 return len(frozenset(self))