diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-06-10 17:23:33 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-06-28 15:27:40 +0100 |
commit | cc2a8ff5225e9fe987d8036970b2bf4293a13611 (patch) | |
tree | 61728fb75a8c92e9653e756abdbc82392efc8ebd | |
parent | fb3800178947e21899227e4ba4db4670b29231c7 (diff) | |
download | ast2050-yocto-poky-cc2a8ff5225e9fe987d8036970b2bf4293a13611.zip ast2050-yocto-poky-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>
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 93c1b81..1fede8f 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -401,18 +401,20 @@ class DataSmart(MutableMapping): yield key def __iter__(self): - seen = set() - def _keys(d): + def keylist(d): + klist = set() + for key in d: + if key == "_data": + continue + klist.add(key) + if "_data" in d: - for key in _keys(d["_data"]): - yield key + klist |= keylist(d["_data"]) - for key in d: - if key != "_data": - if not key in seen: - seen.add(key) - yield key - return _keys(self.dict) + return klist + + for k in keylist(self.dict): + yield k def __len__(self): return len(frozenset(self)) |