1 |
On Sunday 04 December 2005 11:08, Zac Medico wrote: |
2 |
> Ned Ludd wrote: |
3 |
> > With the size of the vdb effecting the speed of portage itself and with |
4 |
> > all the desktop splitting up packages into massively large sets of many |
5 |
> > ebuilds it's becoming apparent that that some optimizations need to be |
6 |
> > done. |
7 |
> > |
8 |
> > strace -o woof -eopen -f python -c 'import portage' |
9 |
> > grep '/var/db/pkg/sys-apps/portage-' woof |
10 |
> > |
11 |
> > You will notice that on a simple import that it's reading everything |
12 |
> > twice. If anybody is up for the challenge of addressing this double |
13 |
> > reading I think the entire user community would be thankful |
14 |
> > (or atleast I would be) |
15 |
> |
16 |
> sandboxshell |
17 |
> adddeny /var/db/pkg |
18 |
> python -c 'import portage' |
19 |
> |
20 |
> From the resulting traceback(s), I was able to see that the /var/db/pkg |
21 |
> reads originate in calls to a getvirtuals() method, which ultimately leads |
22 |
> to a get_all_provides() method. Assuming that the results from |
23 |
> get_all_provides() do not change during the course of the initial 'import |
24 |
> portage', it should be safe to cache the results (until the end of the |
25 |
> import). |
26 |
|
27 |
Following that through a bit further, get_all_provides() is only called by |
28 |
loadVirtuals() which is only called by config.__init__(). getvirtuals() |
29 |
itself is called outside of config.__init() once during initialization as |
30 |
well as by the scripts pkgmerge and repoman. In all three cases, the result |
31 |
is passed to portagetree.__init__(), binarytree.__init() or |
32 |
vartree.__init__(). However, none of those three classes use the passed |
33 |
virtuals anymore. Hence, all calls to getvirtuals() external to the config |
34 |
class could theoretically be dropped and replaced with an empty dictionary. |
35 |
The only possibility of breakage in doing that is if other parts of portage |
36 |
are accessing *tree's "virtual" member directly. |
37 |
|
38 |
-- |
39 |
Jason Stubbs |
40 |
-- |
41 |
gentoo-portage-dev@g.o mailing list |