Gentoo Archives: gentoo-portage-dev

From: Brian Harring <ferringb@×××××.com>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] equery: deprecate --category filtering in belongs
Date: Sun, 08 Feb 2009 05:21:48
Message-Id: 20090208052116.GA4076@hrair
In Reply to: [gentoo-portage-dev] equery: deprecate --category filtering in belongs by Douglas Anderson
1 On Sun, Feb 08, 2009 at 02:07:08PM +0900, Douglas Anderson wrote:
2 > Hi, does anyone use --category filtering in equery belongs? I want to
3 > get rid of it, or at least deprecate it. My reasoning:
4 >
5 > * We use 'equery belongs' when don't know to what package a file
6 > belongs. Even if we have a suspicion, most users would have to look up
7 > the category of the package before typing it in.
8 > * Even if you happen to know the exact category of the package that
9 > installed the file (why are you using belongs?), typing
10 > --category=app-portage takes more time than is saved by filtering by
11 > category (about 5 seconds more by my unscientific test).
12 >
13 > Even in a script setting, I see no use for this. The time saved is minuscule:
14 >
15 > $ time equery belongs /usr/bin/equery --category app-portage
16 > [ Searching for file(s) /usr/bin/equery in app-portage... ]
17 > app-portage/gentoolkit-0.2.4.2-r1 (/usr/bin/equery)
18 >
19 > real 0m4.002s
20 > user 0m3.680s
21 > sys 0m0.076s
22 > $ time equery belongs /usr/bin/equery
23 > [ Searching for file(s) /usr/bin/equery in *... ]
24 > app-portage/gentoolkit-0.2.4.2-r1 (/usr/bin/equery)
25 >
26 > real 0m4.205s
27 > user 0m3.738s
28 > sys 0m0.102s
29
30 You should do profiling, and *verify* category actually works; it
31 should be able to make a world of difference. Case in point via
32 pkgcore-
33
34 ferringb@beast ~ $ time pquery --owns /usr/bin/equery
35 app-portage/gentoolkit-0.2.4.2-r1
36
37 real 0m1.162s
38 user 0m1.142s
39 sys 0m0.020s
40 ferringb@beast ~ $ time pquery --owns /usr/bin/equery 'app-portage/*'
41 app-portage/gentoolkit-0.2.4.2-r1
42
43 real 0m0.168s
44 user 0m0.156s
45 sys 0m0.011s
46
47
48 Yes it's not equery, but I *know* pkgcores implementation works thus
49 using it to point out the speed difference if implemented correctly.
50
51 It would probably help if the category support was enabled in the
52 code, also (quick check of equery shows the cat filtering is
53 disabled).
54
55 ~harring