1 |
I have been thinking a bit more about dfs vs bfs traversals, so here goes :). |
2 |
|
3 |
On Saturday 06 December 2003 06:26, Paul de Vrieze wrote: |
4 |
> |
5 |
> Prolog interpreters work as depth-first searchers. Breath-first is in most |
6 |
Yea, and unfortunately there isn't much choice about it as recursion is pretty |
7 |
much the only composition method the standard talks. |
8 |
|
9 |
> cases a waste of both memory and clock cycles. In the case of portage this |
10 |
Its really only O(n) where small n stands for associated dependencies, so |
11 |
that's not that much. Besides it does nopt require recursion to be |
12 |
implemented, so in reality that hit quite often is not even there. |
13 |
And then it gives: |
14 |
|
15 |
> would mean something like first getting deep dependencies like glibc, and |
16 |
> then less important ones. |
17 |
And isn't this the "right" way to do it? Surely operating on a *complete* |
18 |
portage tree, that is the one where all the dependencies are explicitly |
19 |
stated, that wouldn't make any difference. But in reality glibc and similar |
20 |
dependencies, being a part of the system, are omitted in pretty much all |
21 |
ebuilds. Thus, with DFS traversal (which is what portage does now) one is |
22 |
getting glibc somewhere in the middle of world update quite often, which is |
23 |
not optimal if you want complete coherency (and it can be plain bad in the |
24 |
case of the major update. This is somewhat alleviated in our case for system |
25 |
packages by a mandatory bootstrap, but some stuff on perifery can be hit, if |
26 |
multiple things use the same library and it is affected for example (and not |
27 |
explicitly included, say because it is consdered "basic")). |
28 |
|
29 |
|
30 |
|
31 |
> > I somewhat agree with that. However my observation is that these packages |
32 |
> > most often are libraries or other helpers that user is usualy not |
33 |
> > interested in directly. And the long operations are the ones where you |
34 |
> > have to do searches or operations involving world. So I have been |
35 |
> > thinking along the lines of making the longest operations fast and |
36 |
> > bounded, getting the O(1) |
37 |
> > responsivity. |
38 |
> > But in reality I do not think this shpould be "the ultimate solution" or |
39 |
> > even that there should be one. See the next one. |
40 |
> |
41 |
> I don't believe that the average size of world is going to grow |
42 |
> significantly. |
43 |
No, but quite often it includes "major" packages and that means traversal of a |
44 |
significant portion of the portage.., but the leafs representing uncommon |
45 |
packages are not touched, that I agree on. |
46 |
Thus the more efficient approach (and I had a few thoughts on this, although |
47 |
without much detail, so didn't document it :)) would be to operate on a |
48 |
memory-mapped cache and on startup suck into memory only the entries having |
49 |
weight above certain threshold. Weights should probably be proportional to |
50 |
the numbers of dependencies *coming into* the correpsponding package. Thus |
51 |
commonly used stuff gets read and the traversals are instantaneous, but 99% |
52 |
of the tree just sits on disk waitning to be called for... |
53 |
|
54 |
|
55 |
> > And finally: |
56 |
> > > My biggest concern when reading your small paper is that you chose a |
57 |
> > > deterministic approach to this problem, while in fact the problem is |
58 |
> > > non-determinisitic. |
59 |
> > |
60 |
> > Could you please elaborate? I am afraid we are thinking about slightly |
61 |
> > different things here. |
62 |
> |
63 |
> I didn't write that, guess you'll need to ask the person who did. |
64 |
Um, sorry, I somehow got confused and thought some postings on -dev were from |
65 |
you as well. I just sent relevant parts to proper place :). |
66 |
|
67 |
George |
68 |
|
69 |
|
70 |
|
71 |
-- |
72 |
gentoo-portage-dev@g.o mailing list |