mirror of
https://git.yoctoproject.org/poky
synced 2026-09-16 09:49:35 +02: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:
@@ -401,18 +401,20 @@ class DataSmart(MutableMapping):
|
|||||||
yield key
|
yield key
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
seen = set()
|
def keylist(d):
|
||||||
def _keys(d):
|
klist = set()
|
||||||
if "_data" in d:
|
|
||||||
for key in _keys(d["_data"]):
|
|
||||||
yield key
|
|
||||||
|
|
||||||
for key in d:
|
for key in d:
|
||||||
if key != "_data":
|
if key == "_data":
|
||||||
if not key in seen:
|
continue
|
||||||
seen.add(key)
|
klist.add(key)
|
||||||
yield key
|
|
||||||
return _keys(self.dict)
|
if "_data" in d:
|
||||||
|
klist |= keylist(d["_data"])
|
||||||
|
|
||||||
|
return klist
|
||||||
|
|
||||||
|
for k in keylist(self.dict):
|
||||||
|
yield k
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(frozenset(self))
|
return len(frozenset(self))
|
||||||
|
|||||||
Reference in New Issue
Block a user