bitbake: data_smart: Skip commonly accessed variables from variable data context lookup

The code tries to expand missing entities when they're encountered in
python expressions. Looking at traces, these are often things which
would not be in the data store such as "bb".

Optimise to skip the data store queries for things we know will never
be there. The expansion cache usually covers these but skipping
entirely cuts a few million function calls parsing OE-Core.

(Bitbake rev: 1ae712635a2eef3ecbf541e1f7cc2eeb2f3799c9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2022-03-16 13:32:36 +00:00
parent e838455c34
commit c45c830800

View File

@@ -152,6 +152,9 @@ class DataContext(dict):
self['d'] = metadata
def __missing__(self, key):
# Skip commonly accessed invalid variables
if key in ['bb', 'oe', 'int', 'bool', 'time', 'str', 'os']:
raise KeyError(key)
value = self.metadata.getVar(key)
if value is None or self.metadata.getVarFlag(key, 'func', False):
raise KeyError(key)