mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
bitbake: data_smart: Small cache reuse optimization
Currently the expand cache doesn't work for "parser" return types, which is the main type used by the build_dependencies() call that we spend most of the time in when parsing. Tweak the code to cache the unexpanded value in the expand cache and hence allow reuse of the parser in other fast path cases for small speed gains. (Bitbake rev: b4a8e5071dbcba2217b79e83e08b275ffcbc0eef) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
70a7e7337b
commit
43ef392dc2
|
@ -92,10 +92,11 @@ def infer_caller_details(loginfo, parent = False, varval = True):
|
|||
loginfo['func'] = func
|
||||
|
||||
class VariableParse:
|
||||
def __init__(self, varname, d, val = None):
|
||||
def __init__(self, varname, d, unexpanded_value = None, val = None):
|
||||
self.varname = varname
|
||||
self.d = d
|
||||
self.value = val
|
||||
self.unexpanded_value = unexpanded_value
|
||||
|
||||
self.references = set()
|
||||
self.execs = set()
|
||||
|
@ -447,9 +448,9 @@ class DataSmart(MutableMapping):
|
|||
def expandWithRefs(self, s, varname):
|
||||
|
||||
if not isinstance(s, str): # sanity check
|
||||
return VariableParse(varname, self, s)
|
||||
return VariableParse(varname, self, s, s)
|
||||
|
||||
varparse = VariableParse(varname, self)
|
||||
varparse = VariableParse(varname, self, s)
|
||||
|
||||
while s.find('${') != -1:
|
||||
olds = s
|
||||
|
@ -775,6 +776,9 @@ class DataSmart(MutableMapping):
|
|||
return None
|
||||
cachename = var + "[" + flag + "]"
|
||||
|
||||
if not expand and retparser and cachename in self.expand_cache:
|
||||
return self.expand_cache[cachename].unexpanded_value, self.expand_cache[cachename]
|
||||
|
||||
if expand and cachename in self.expand_cache:
|
||||
return self.expand_cache[cachename].value
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user