All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] data: fix performance regression
@ 2013-04-15 14:27 Paul Eggleton
  2013-04-15 15:49 ` Chris Larson
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggleton @ 2013-04-15 14:27 UTC (permalink / raw)
  To: bitbake-devel

BitBake commit 7c568132c54a21161de28907159f902462f1e2bb resulted in a
fairly serious performance regression during parsing, almost doubling
the time taken to do a full parse and almost certainly impacting
performance during building. The expandKeys function is called
frequently, and if we avoid using keys() and instead just use the normal
variable lookup mechanism, performance is restored.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 lib/bb/data.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/bb/data.py b/lib/bb/data.py
index 110666c..abf210a 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -158,9 +158,9 @@ def expandKeys(alterdata, readdata = None):
 
     for key in todolist:
         ekey = todolist[key]
-        if ekey in keys(alterdata):
+        newval = alterdata.getVar(ekey, 0)
+        if newval:
             val = alterdata.getVar(key, 0)
-            newval = alterdata.getVar(ekey, 0)
             if val is not None and newval is not None:
                 bb.warn("Variable key %s (%s) replaces original key %s (%s)." % (key, val, ekey, newval))
         alterdata.renameVar(key, ekey)
-- 
1.7.10.4




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] data: fix performance regression
  2013-04-15 14:27 [PATCH] data: fix performance regression Paul Eggleton
@ 2013-04-15 15:49 ` Chris Larson
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Larson @ 2013-04-15 15:49 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: bitbake-devel@lists.openembedded.org

[-- Attachment #1: Type: text/plain, Size: 842 bytes --]

On Mon, Apr 15, 2013 at 7:27 AM, Paul Eggleton <
paul.eggleton@linux.intel.com> wrote:

> BitBake commit 7c568132c54a21161de28907159f902462f1e2bb resulted in a
> fairly serious performance regression during parsing, almost doubling
> the time taken to do a full parse and almost certainly impacting
> performance during building. The expandKeys function is called
> frequently, and if we avoid using keys() and instead just use the normal
> variable lookup mechanism, performance is restored.
>
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
>

I would suggest using the existing __contains__ mechanism provided by
DataSmart.

    if newval in alterdata:

Should be sufficient, as MutableMapping from collections provides
__contains__ from Mapping, which in turn uses __getitem__.
-- 
Christopher Larson

[-- Attachment #2: Type: text/html, Size: 1366 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-15 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-15 14:27 [PATCH] data: fix performance regression Paul Eggleton
2013-04-15 15:49 ` Chris Larson

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.