summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/data_smart.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-16 13:32:36 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-18 13:17:10 +0000
commitc45c8308006833e80ffa7fa84e647cea44148de0 (patch)
tree9f9ddbfa1add64aaf3aa8503dc515ef83d65c31a /bitbake/lib/bb/data_smart.py
parente838455c34aa2bdc406741dcc5e4673352ef16cb (diff)
downloadpoky-c45c8308006833e80ffa7fa84e647cea44148de0.tar.gz
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>
Diffstat (limited to 'bitbake/lib/bb/data_smart.py')
-rw-r--r--bitbake/lib/bb/data_smart.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 8d3825f398..ca78d84133 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -152,6 +152,9 @@ class DataContext(dict):
152 self['d'] = metadata 152 self['d'] = metadata
153 153
154 def __missing__(self, key): 154 def __missing__(self, key):
155 # Skip commonly accessed invalid variables
156 if key in ['bb', 'oe', 'int', 'bool', 'time', 'str', 'os']:
157 raise KeyError(key)
155 value = self.metadata.getVar(key) 158 value = self.metadata.getVar(key)
156 if value is None or self.metadata.getVarFlag(key, 'func', False): 159 if value is None or self.metadata.getVarFlag(key, 'func', False):
157 raise KeyError(key) 160 raise KeyError(key)