From: Richard Purdie <rpurdie@linux.intel.com>
To: "Xu, Dongxiao" <dongxiao.xu@intel.com>
Cc: "poky@yoctoproject.org" <poky@yoctoproject.org>
Subject: Re: [PATCH 0/1][RFC] Optimize file parsing speed
Date: Mon, 29 Nov 2010 04:41:56 -0800 [thread overview]
Message-ID: <1291034516.14277.966.camel@rex> (raw)
In-Reply-To: <D5AB6E638E5A3E4B8F4406B113A5A19A30346BE1@shsmsx501.ccr.corp.intel.com>
On Mon, 2010-11-29 at 13:45 +0800, Xu, Dongxiao wrote:
> Richard Purdie wrote:
> > I'm going to take the patch but I'd like to be clear where the speed
> > gains come from with this change. I suspect some are due to a smaller
> > number of keys but I also suspect the smaller number of tasks
> > involved helps too!
>
> I did a profiling for the parsing time w/ and w/o the patch.
>
> Here a piece of the profiling result:
>
> W/ PATCH:
>
> Mon Nov 29 13:23:42 2010 profile.log
>
> 32756805 function calls (31268348 primitive calls) in 60.195 CPU seconds
>
> Ordered by: internal time
>
> ncalls tottime percall cumtime percall filename:lineno(function)
> 3572737 4.950 0.000 12.849 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/data_smart.py:285(getVarFlag)
> 3917977 4.464 0.000 4.464 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/data_smart.py:191(_findVar)
> 873129/431998 3.040 0.000 16.824 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/data_smart.py:86(expandWithRefs)
> 1745340 3.007 0.000 4.555 0.000 /usr/lib/python2.6/copy.py:65(copy)
> 286785 2.570 0.000 20.051 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/data.py:271(build_dependencies)
> 565710 2.532 0.000 5.015 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/COW.py:97(__getitem__)
> 917 2.394 0.003 27.726 0.030 /sda1/yocto/scripts/..//bitbake/lib/bb/data.py:299(generate_dependencies)
> 288439 2.350 0.000 11.607 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/data_smart.py:212(setVar)
> 1428066/1144003 1.882 0.000 16.762 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/data_smart.py:246(getVar)
> ...
> 2389 0.004 0.000 2.528 0.001 /sda1/yocto/scripts/..//bitbake/lib/bb/data.py:267(update_data)
>
>
> W/O PATCH:
>
> Mon Nov 29 13:28:36 2010 profile.log
>
> 49110091 function calls (47618793 primitive calls) in 75.338 CPU seconds
>
> Ordered by: internal time
>
> ncalls tottime percall cumtime percall filename:lineno(function)
> 7547331 8.230 0.000 19.467 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/data_smart.py:285(getVarFlag)
> 7908236 8.113 0.000 8.113 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/data_smart.py:191(_findVar)
> 917 3.987 0.004 43.045 0.047 /sda1/yocto/scripts/..//bitbake/lib/bb/data.py:299(generate_dependencies)
> 5061763 3.812 0.000 5.633 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/data.py:301(<genexpr>)
> 84656 3.318 0.000 13.475 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/data.py:302(<genexpr>)
> 897804/450300 2.838 0.000 15.801 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/data_smart.py:86(expandWithRefs)
> 294083 2.777 0.000 18.854 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/data.py:271(build_dependencies)
> 1783941 2.740 0.000 4.154 0.000 /usr/lib/python2.6/copy.py:65(copy)
> 592115 2.432 0.000 5.179 0.000 /sda1/yocto/scripts/..//bitbake/lib/bb/COW.py:97(__getitem__)
> ...
> 2389 0.004 0.000 2.656 0.001 /sda1/yocto/scripts/..//bitbake/lib/bb/data.py:267(update_data)
>
> From the profiling result we can see that, generate_dependencies()
> time reduces from 43 seconds to 27 seconds, while build_dependencies()
> mostly keeps unchanged (From 20 seconds to 18.8 seconds). Therefore
> the biggest overhead reduced by the patch should be the two lines of
> code to parsing keys in generate_dependencies() function.
>
> >
> > Also, a lot of those keys are override keys so perhaps its speeding up
> > update_data() calls and some of the gain is from there too?
>
> Update_data() has some gains but not much, see the above profile result.
Looks good, thanks.
Interestingly looking at the profile overall, we dropped from 49 million
function calls to 32 million function calls which is always a good way
to speed things up.
getVarFlag and _findVar each dropped by 3 million calls each (which is
from the construction of the keys() list).
So a very valid speedup :). I still think we might be able to speed this
area up further though such as if we directly keep an index of exported
variables.
Cheers,
Richard
next prev parent reply other threads:[~2010-11-29 12:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-22 6:04 [PATCH 0/1][RFC] Optimize file parsing speed Dongxiao Xu
2010-11-22 6:02 ` [PATCH 1/1] utility-tasks.bbclass: Move distro related tasks to distrodata.bbclass Dongxiao Xu
2010-11-28 14:27 ` [PATCH 0/1][RFC] Optimize file parsing speed Richard Purdie
2010-11-29 0:32 ` Tian, Kevin
2010-11-29 5:45 ` Xu, Dongxiao
2010-11-29 12:41 ` Richard Purdie [this message]
2010-12-01 1:48 ` Xu, Dongxiao
2010-12-08 6:53 ` Xu, Dongxiao
2010-12-09 14:40 ` 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=1291034516.14277.966.camel@rex \
--to=rpurdie@linux.intel.com \
--cc=dongxiao.xu@intel.com \
--cc=poky@yoctoproject.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.