Patchwork ptest: d.keys() is slow, use a list instead

login
register
mail settings
Submitter Richard Purdie
Date Jan. 14, 2014, 11:43 a.m.
Message ID <1389699794.14987.43.camel@ted>
Download mbox | patch
Permalink /patch/64721/
State New
Headers show

Comments

Richard Purdie - Jan. 14, 2014, 11:43 a.m.
Unfortunately d.keys is extremely slow. Using a list in this case should be
fine since the addtask lines are immediately above the code and aren't
going to change often.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
Otavio Salvador - Jan. 14, 2014, 11:56 a.m.
On Tue, Jan 14, 2014 at 9:43 AM, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> Unfortunately d.keys is extremely slow. Using a list in this case should be
> fine since the addtask lines are immediately above the code and aren't
> going to change often.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>

A code comment stating it needs to be update would be good.

Patch

diff --git a/meta/classes/ptest.bbclass b/meta/classes/ptest.bbclass
index e5bbb89..caf7101 100644
--- a/meta/classes/ptest.bbclass
+++ b/meta/classes/ptest.bbclass
@@ -55,6 +55,6 @@  python () {
 
     # Remove all '*ptest_base' tasks when ptest is not enabled
     if not(d.getVar('PTEST_ENABLED', True) == "1"):
-        for i in filter(lambda k: d.getVarFlag(k, "task") and k.endswith("ptest_base"), d.keys()):
+        for i in ['do_configure_ptest_base', 'do_compile_ptest_base', 'do_install_ptest_base']:
             bb.build.deltask(i, d)
 }