summaryrefslogtreecommitdiffstats
path: root/lib/bb/data_smart.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-29 10:33:04 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-12 22:50:27 +0100
commitdb9a4eedcf78969ec50bf0e4a8defba8ff0daa4a (patch)
treec00ed576359d5689cb7311b45b3f282aab732a54 /lib/bb/data_smart.py
parent07d773369f571028c2cf82dd1f65d9731af6d00e (diff)
downloadopenembedded-core-contrib-db9a4eedcf78969ec50bf0e4a8defba8ff0daa4a.tar.gz
data_smart: Cache set(self.overrides)
This performs better than continually regeneratiing the set(). Also only use set comparisions when its necessary to save some overhead as issubset() is slower in the single item case. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/data_smart.py')
-rw-r--r--lib/bb/data_smart.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index c91b51f686..941c158f7d 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -369,7 +369,9 @@ class DataSmart(MutableMapping):
self.inoverride = True
# Can end up here recursively so setup dummy values
self.overrides = []
+ self.overridesset = set()
self.overrides = (self.getVar("OVERRIDES", True) or "").split(":") or []
+ self.overridesset = set(self.overrides)
self.inoverride = False
self.expand_cache = {}
@@ -450,10 +452,10 @@ class DataSmart(MutableMapping):
active = []
self.need_overrides()
for (r, o) in self.overridedata[var]:
- if o in self.overrides:
+ if o in self.overridesset:
active.append(r)
elif "_" in o:
- if set(o.split("_")).issubset(set(self.overrides)):
+ if set(o.split("_")).issubset(self.overridesset):
active.append(r)
for a in active:
self.delVar(a)
@@ -600,10 +602,12 @@ class DataSmart(MutableMapping):
self.need_overrides()
for (r, o) in self.overridedata[var]:
# What about double overrides both with "_" in the name?
- if o in self.overrides:
- active[o] = r
- elif set(o.split("_")).issubset(set(self.overrides)):
+ if o in self.overridesset:
active[o] = r
+ elif "_" in o:
+ if set(o.split("_")).issubset(self.overridesset):
+ active[o] = r
+
mod = True
while mod:
mod = False