diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-29 10:33:04 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-12 22:50:46 +0100 |
commit | 816acb6ee8ca8ac8791bf89c32aa45f808d5d52f (patch) | |
tree | a1854232007e08bd001dcbd1c2a2caddcfe2398d /bitbake | |
parent | 0ac9c80e0866b095b2c2376801224a9c2c1ef39e (diff) | |
download | poky-816acb6ee8ca8ac8791bf89c32aa45f808d5d52f.tar.gz |
bitbake: 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.
(Bitbake rev: db9a4eedcf78969ec50bf0e4a8defba8ff0daa4a)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index c91b51f686..941c158f7d 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -369,7 +369,9 @@ class DataSmart(MutableMapping): | |||
369 | self.inoverride = True | 369 | self.inoverride = True |
370 | # Can end up here recursively so setup dummy values | 370 | # Can end up here recursively so setup dummy values |
371 | self.overrides = [] | 371 | self.overrides = [] |
372 | self.overridesset = set() | ||
372 | self.overrides = (self.getVar("OVERRIDES", True) or "").split(":") or [] | 373 | self.overrides = (self.getVar("OVERRIDES", True) or "").split(":") or [] |
374 | self.overridesset = set(self.overrides) | ||
373 | self.inoverride = False | 375 | self.inoverride = False |
374 | self.expand_cache = {} | 376 | self.expand_cache = {} |
375 | 377 | ||
@@ -450,10 +452,10 @@ class DataSmart(MutableMapping): | |||
450 | active = [] | 452 | active = [] |
451 | self.need_overrides() | 453 | self.need_overrides() |
452 | for (r, o) in self.overridedata[var]: | 454 | for (r, o) in self.overridedata[var]: |
453 | if o in self.overrides: | 455 | if o in self.overridesset: |
454 | active.append(r) | 456 | active.append(r) |
455 | elif "_" in o: | 457 | elif "_" in o: |
456 | if set(o.split("_")).issubset(set(self.overrides)): | 458 | if set(o.split("_")).issubset(self.overridesset): |
457 | active.append(r) | 459 | active.append(r) |
458 | for a in active: | 460 | for a in active: |
459 | self.delVar(a) | 461 | self.delVar(a) |
@@ -600,10 +602,12 @@ class DataSmart(MutableMapping): | |||
600 | self.need_overrides() | 602 | self.need_overrides() |
601 | for (r, o) in self.overridedata[var]: | 603 | for (r, o) in self.overridedata[var]: |
602 | # What about double overrides both with "_" in the name? | 604 | # What about double overrides both with "_" in the name? |
603 | if o in self.overrides: | 605 | if o in self.overridesset: |
604 | active[o] = r | ||
605 | elif set(o.split("_")).issubset(set(self.overrides)): | ||
606 | active[o] = r | 606 | active[o] = r |
607 | elif "_" in o: | ||
608 | if set(o.split("_")).issubset(self.overridesset): | ||
609 | active[o] = r | ||
610 | |||
607 | mod = True | 611 | mod = True |
608 | while mod: | 612 | while mod: |
609 | mod = False | 613 | mod = False |