diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-11-22 09:54:11 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-11-23 18:27:07 +0000 |
commit | 61fac62194b3c7e1c31a9119390f4f960077dea4 (patch) | |
tree | 8df9d6b92f187b61894972dbb1851ea4c50d3dea /bitbake/lib/bb/siggen.py | |
parent | f68a10b5cf7e0ffc558b01d56bd7801a0696cf29 (diff) | |
download | poky-61fac62194b3c7e1c31a9119390f4f960077dea4.tar.gz |
bitbake: data/siggen: Switch to use frozensets and optimize
Python handles frozensets a little more optimally than normal sets. Once we
finish parsing, we don't edit this data so we can convert to them.
To do that, we need to stop changing them so process ignore_deps earlier
then we can freeze the data and keep it frozen.
This has the side effect that we need to be careful to sort the data
in some of the variables when calculating the hashes.
Overall this does seem to show a decent parsing time speed improvement
of 20-25% in a local test but this would be highly setup dependent.
Also ensure the sigdata can handle exported frozenset and make it import
back to them instead of sets.
(Bitbake rev: 19475627c363a52da49ec144422c87448ff2a6c5)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/siggen.py')
-rw-r--r-- | bitbake/lib/bb/siggen.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py index 07bb529452..72b906c153 100644 --- a/bitbake/lib/bb/siggen.py +++ b/bitbake/lib/bb/siggen.py | |||
@@ -25,13 +25,13 @@ hashequiv_logger = logging.getLogger('BitBake.SigGen.HashEquiv') | |||
25 | 25 | ||
26 | class SetEncoder(json.JSONEncoder): | 26 | class SetEncoder(json.JSONEncoder): |
27 | def default(self, obj): | 27 | def default(self, obj): |
28 | if isinstance(obj, set): | 28 | if isinstance(obj, set) or isinstance(obj, frozenset): |
29 | return dict(_set_object=list(sorted(obj))) | 29 | return dict(_set_object=list(sorted(obj))) |
30 | return json.JSONEncoder.default(self, obj) | 30 | return json.JSONEncoder.default(self, obj) |
31 | 31 | ||
32 | def SetDecoder(dct): | 32 | def SetDecoder(dct): |
33 | if '_set_object' in dct: | 33 | if '_set_object' in dct: |
34 | return set(dct['_set_object']) | 34 | return frozenset(dct['_set_object']) |
35 | return dct | 35 | return dct |
36 | 36 | ||
37 | def init(d): | 37 | def init(d): |
@@ -1056,7 +1056,7 @@ def calc_basehash(sigdata): | |||
1056 | basedata = '' | 1056 | basedata = '' |
1057 | 1057 | ||
1058 | alldeps = sigdata['taskdeps'] | 1058 | alldeps = sigdata['taskdeps'] |
1059 | for dep in alldeps: | 1059 | for dep in sorted(alldeps): |
1060 | basedata = basedata + dep | 1060 | basedata = basedata + dep |
1061 | val = sigdata['varvals'][dep] | 1061 | val = sigdata['varvals'][dep] |
1062 | if val is not None: | 1062 | if val is not None: |