All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dongxiao Xu <dongxiao.xu@intel.com>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH 1/1] data_smart.py: make use of expand cache in getVar()
Date: Mon, 29 Aug 2011 15:33:58 +0800	[thread overview]
Message-ID: <a27f9fa325927a2b0c2204f648f762463c62a8f0.1314603042.git.dongxiao.xu@intel.com> (raw)
In-Reply-To: <cover.1314603042.git.dongxiao.xu@intel.com>
In-Reply-To: <cover.1314603042.git.dongxiao.xu@intel.com>

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@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
 
     def renameVar(self, key, newkey):
         """
-- 
1.7.1




  reply	other threads:[~2011-08-29  7:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-29  7:33 [PATCH 0/1][PULL] bitbake: parsing time improvement Dongxiao Xu
2011-08-29  7:33 ` Dongxiao Xu [this message]
2011-08-29 12:55   ` [PATCH 1/1] data_smart.py: make use of expand cache in getVar() Richard Purdie
2011-08-29 13:07     ` Xu, Dongxiao
2011-08-29 13:13       ` Richard Purdie
2011-08-29 13:15         ` Xu, Dongxiao
2011-08-29 14:21         ` Xu, Dongxiao
2011-08-30 21:09           ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a27f9fa325927a2b0c2204f648f762463c62a8f0.1314603042.git.dongxiao.xu@intel.com \
    --to=dongxiao.xu@intel.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.