data_smart.py: make use of expand cache in getVar()

Currently if passing expand=True to getVar() function, it will pass the
handling to getVarFlag(), which doesn't get any benefit from the expand
cache.

Call the expand() function separately in getVar() to make use of the
expand cache, which can decrease the parsing time by 40%.
(from current 49s to 27s)

(Bitbake rev: 6555a77c199f41bf35460138764e03e30c56d29f)

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Dongxiao Xu 2011-08-29 15:33:58 +08:00 committed by Richard Purdie
parent 5d75eb2739
commit dfce2695b9
1 changed files with 6 additions and 1 deletions

View File

@ -268,7 +268,12 @@ class DataSmart(MutableMapping):
self.dict[var]["content"] = value
def getVar(self, var, expand=False, noweakdefault=False):
return self.getVarFlag(var, "content", expand, noweakdefault)
value = self.getVarFlag(var, "content", False, noweakdefault)
# Call expand() separately to make use of the expand cache
if expand and value:
return self.expand(value, var)
return value
def renameVar(self, key, newkey):
"""