All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: [PATCH] parse/ast: Optimise data finalisation
Date: Sun, 13 Apr 2014 11:48:53 +0100	[thread overview]
Message-ID: <1397386133.15843.50.camel@ted> (raw)

The optimisation where only the data we're interested in was finalised
was good but it turns out we can do better. In the case where a 
class-extension is to be targeted, we can skip the other targets.

This change does that and speeds up parsing at the bitbake-worker 
execution time. Specifically, you can see an improvement in the speed
of bitbake X -n.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index d8c141b..b930370 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -337,8 +337,10 @@ def finalize(fn, d, variant = None):
 
     bb.event.fire(bb.event.RecipeParsed(fn), d)
 
-def _create_variants(datastores, names, function):
+def _create_variants(datastores, names, function, onlyfinalise):
     def create_variant(name, orig_d, arg = None):
+        if onlyfinalise and name not in onlyfinalise:
+            return
         new_d = bb.data.createCopy(orig_d)
         function(arg or name, new_d)
         datastores[name] = new_d
@@ -383,7 +385,8 @@ def multi_finalize(fn, d):
     safe_d = d
     d = bb.data.createCopy(safe_d)
     try:
-        finalize(fn, d)
+        if not onlyfinalise or "default" in onlyfinalise:
+            finalize(fn, d)
     except bb.parse.SkipPackage as e:
         d.setVar("__SKIPPED", e.args[0])
     datastores = {"": safe_d}
@@ -430,7 +433,7 @@ def multi_finalize(fn, d):
             except bb.parse.SkipPackage as e:
                 d.setVar("__SKIPPED", e.args[0])
 
-        _create_variants(datastores, versions, verfunc)
+        _create_variants(datastores, versions, verfunc, onlyfinalise)
 
     extended = d.getVar("BBCLASSEXTEND", True) or ""
     if extended:
@@ -460,7 +463,7 @@ def multi_finalize(fn, d):
             bb.parse.BBHandler.inherit(extendedmap[name], fn, 0, d)
 
         safe_d.setVar("BBCLASSEXTEND", extended)
-        _create_variants(datastores, extendedmap.keys(), extendfunc)
+        _create_variants(datastores, extendedmap.keys(), extendfunc, onlyfinalise)
 
     for variant, variant_d in datastores.iteritems():
         if variant:




                 reply	other threads:[~2014-04-13 10:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1397386133.15843.50.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --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.