diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-26 08:27:15 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-12 22:50:45 +0100 |
commit | 2dbb067eba4efe3216fd4dbc0103c63f883d8ef4 (patch) | |
tree | 5612cd116971b6e3628bcf0fe5d14787242b4f22 /bitbake | |
parent | d8ebb4708b31dc74a61880cad977cd80a7c8bb08 (diff) | |
download | poky-2dbb067eba4efe3216fd4dbc0103c63f883d8ef4.tar.gz |
bitbake: data_smart: Tweak OVERRIDES value cache for performance
Updating the value of OVERRIDES whenever it changes turns out to be
extremely expensve/pointless. Instead, clear its value and re-establish
the value when we're going to use it.
This gives significant speed back.
(Bitbake rev: 41cf8d0c92d2d8a33fdad0921e424a0024914be1)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 4ccbedbfab..c800a9a106 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -311,8 +311,7 @@ class DataSmart(MutableMapping): | |||
311 | 311 | ||
312 | # cookie monster tribute | 312 | # cookie monster tribute |
313 | self.overridedata = {} | 313 | self.overridedata = {} |
314 | 314 | self.overrides = None | |
315 | self.overrides = [] | ||
316 | self.overridevars = set(["OVERRIDES", "FILE"]) | 315 | self.overridevars = set(["OVERRIDES", "FILE"]) |
317 | 316 | ||
318 | def enableTracking(self): | 317 | def enableTracking(self): |
@@ -360,8 +359,13 @@ class DataSmart(MutableMapping): | |||
360 | 359 | ||
361 | def internal_finalize(self, parent = False): | 360 | def internal_finalize(self, parent = False): |
362 | """Performs final steps upon the datastore, including application of overrides""" | 361 | """Performs final steps upon the datastore, including application of overrides""" |
362 | self.overrides = None | ||
363 | 363 | ||
364 | self.overrides = (self.getVar("OVERRIDES", True) or "").split(":") or [] | 364 | def need_overrides(self): |
365 | if self.overrides is None: | ||
366 | self.overrides = [] | ||
367 | self.overrides = (self.getVar("OVERRIDES", True) or "").split(":") or [] | ||
368 | self.expand_cache = {} | ||
365 | 369 | ||
366 | def initVar(self, var): | 370 | def initVar(self, var): |
367 | self.expand_cache = {} | 371 | self.expand_cache = {} |
@@ -587,6 +591,7 @@ class DataSmart(MutableMapping): | |||
587 | if flag == "_content" and var in self.overridedata and not parsing: | 591 | if flag == "_content" and var in self.overridedata and not parsing: |
588 | match = False | 592 | match = False |
589 | active = {} | 593 | active = {} |
594 | self.need_overrides() | ||
590 | for (r, o) in self.overridedata[var]: | 595 | for (r, o) in self.overridedata[var]: |
591 | # What about double overrides both with "_" in the name? | 596 | # What about double overrides both with "_" in the name? |
592 | if o in self.overrides: | 597 | if o in self.overrides: |
@@ -619,6 +624,7 @@ class DataSmart(MutableMapping): | |||
619 | if flag == "_content" and local_var is not None and "_append" in local_var and not parsing: | 624 | if flag == "_content" and local_var is not None and "_append" in local_var and not parsing: |
620 | if not value: | 625 | if not value: |
621 | value = "" | 626 | value = "" |
627 | self.need_overrides() | ||
622 | for (r, o) in local_var["_append"]: | 628 | for (r, o) in local_var["_append"]: |
623 | match = True | 629 | match = True |
624 | if o: | 630 | if o: |
@@ -631,6 +637,7 @@ class DataSmart(MutableMapping): | |||
631 | if flag == "_content" and local_var is not None and "_prepend" in local_var and not parsing: | 637 | if flag == "_content" and local_var is not None and "_prepend" in local_var and not parsing: |
632 | if not value: | 638 | if not value: |
633 | value = "" | 639 | value = "" |
640 | self.need_overrides() | ||
634 | for (r, o) in local_var["_prepend"]: | 641 | for (r, o) in local_var["_prepend"]: |
635 | 642 | ||
636 | match = True | 643 | match = True |
@@ -652,6 +659,7 @@ class DataSmart(MutableMapping): | |||
652 | 659 | ||
653 | if value and flag == "_content" and local_var is not None and "_remove" in local_var: | 660 | if value and flag == "_content" and local_var is not None and "_remove" in local_var: |
654 | removes = [] | 661 | removes = [] |
662 | self.need_overrides() | ||
655 | for (r, o) in local_var["_remove"]: | 663 | for (r, o) in local_var["_remove"]: |
656 | match = True | 664 | match = True |
657 | if o: | 665 | if o: |
@@ -762,7 +770,7 @@ class DataSmart(MutableMapping): | |||
762 | 770 | ||
763 | data._tracking = self._tracking | 771 | data._tracking = self._tracking |
764 | 772 | ||
765 | data.overrides = copy.copy(self.overrides) | 773 | data.overrides = None |
766 | data.overridevars = copy.copy(self.overridevars) | 774 | data.overridevars = copy.copy(self.overridevars) |
767 | data.overridedata = copy.copy(self.overridedata) | 775 | data.overridedata = copy.copy(self.overridedata) |
768 | 776 | ||