[bitbake-devel] [PATCH 1/1] data_smart.py: make use of expand cache in getVar()

Richard Purdie richard.purdie at linuxfoundation.org
Mon Aug 29 12:55:19 UTC 2011


On Mon, 2011-08-29 at 15:33 +0800, Dongxiao Xu wrote:
> 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)
> 
> Signed-off-by: Dongxiao Xu <dongxiao.xu at intel.com>
> ---
>  lib/bb/data_smart.py |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
> index 301f9e3..d8ba24f 100644
> --- a/lib/bb/data_smart.py
> +++ b/lib/bb/data_smart.py
> @@ -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
>  

Why can't we have getVarFlag use the expand cache?

Cheers,

Richard





More information about the bitbake-devel mailing list