mirror of
git://git.yoctoproject.org/poky
synced 2026-08-12 23:06:07 +00:00
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>
This commit is contained in:
parent
fb38001789
commit
cc2a8ff522
@ -401,18 +401,20 @@ class DataSmart(MutableMapping):
|
||||
yield key
|
||||
|
||||
def __iter__(self):
|
||||
seen = set()
|
||||
def _keys(d):
|
||||
if "_data" in d:
|
||||
for key in _keys(d["_data"]):
|
||||
yield key
|
||||
|
||||
def keylist(d):
|
||||
klist = set()
|
||||
for key in d:
|
||||
if key != "_data":
|
||||
if not key in seen:
|
||||
seen.add(key)
|
||||
yield key
|
||||
return _keys(self.dict)
|
||||
if key == "_data":
|
||||
continue
|
||||
klist.add(key)
|
||||
|
||||
if "_data" in d:
|
||||
klist |= keylist(d["_data"])
|
||||
|
||||
return klist
|
||||
|
||||
for k in keylist(self.dict):
|
||||
yield k
|
||||
|
||||
def __len__(self):
|
||||
return len(frozenset(self))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user