public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Brian Harring <ferringb@gmail.com>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] equery: deprecate --category filtering in belongs
Date: Sat, 7 Feb 2009 22:30:15 -0800	[thread overview]
Message-ID: <20090208063015.GB4076@hrair> (raw)
In-Reply-To: <efeb8d230902072107x4d88c029y64c1573219bd59c6@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1709 bytes --]

patch attached against 0.2.4.2-r1; rough stats follow;

full cold cache

[ Searching for file(s) /usr/bin/equery in *... ]
app-portage/gentoolkit-0.2.4.2-r1 (/usr/bin/equery)

real    0m10.320s
user    0m0.733s
sys     0m0.162s

[ Searching for file(s) /usr/bin/equery in app-portage... ]
app-portage/gentoolkit-0.2.4.2-r1 (/usr/bin/equery)

real    0m8.512s
user    0m0.315s
sys     0m0.124s

That particular cold cache is a *full* cold cache; not the best test 
imo since most users have at least some chunks of portage 
configuration/python cached.


Cold cache, with equery --help primer to warm the cache; CONTENTS 
(what belongs operates on) is still out of the cache however making 
this a bit more likely use scenario.

[ Searching for file(s) /usr/bin/equery in *... ]
app-portage/gentoolkit-0.2.4.2-r1 (/usr/bin/equery)

real    0m2.335s
user    0m0.670s
sys     0m0.050s

[ Searching for file(s) /usr/bin/equery in app-portage... ]
app-portage/gentoolkit-0.2.4.2-r1 (/usr/bin/equery)

real    0m0.391s
user    0m0.248s
sys     0m0.046s

Pretty heavy difference, no?


hotcache:
[ Searching for file(s) /usr/bin/equery in *... ]
app-portage/gentoolkit-0.2.4.2-r1 (/usr/bin/equery)

real    0m0.710s
user    0m0.661s
sys     0m0.047s

[ Searching for file(s) /usr/bin/equery in app-portage... ]
app-portage/gentoolkit-0.2.4.2-r1 (/usr/bin/equery)

real    0m0.291s
user    0m0.237s
sys     0m0.053s


Mind you this isn't multiple runs, so the numbers are rough 
approximations- that said they're fairly representative.

Strongly suggest y'all keep category support (although I'll keep on 
using pquery instead ;).

Cheers,
~harring

[-- Attachment #1.2: equery-enable-categories.patch --]
[-- Type: text/plain, Size: 1082 bytes --]

--- /usr/bin/equery	2009-02-07 13:16:51.000000000 -0800
+++ /home/ferringb/equery	2009-02-07 14:15:52.000000000 -0800
@@ -345,7 +345,7 @@
 				need_help = 1
 				break
 			elif x in ["-c", "--category"]:
-				opts["category"] = args[i+1]
+				opts["category"] = args[i+1].rstrip("/")
 				skip = 1
 			elif x in ["-e", "--earlyout"]:
 				opts["earlyOut"] = 1
@@ -383,16 +383,14 @@
 			die(2, "The query '" + pp.regexpquery(q) + "' does not appear to be a valid regular expression")
 
 		# Pick out only selected categories
-		cat = opts["category"]
-		filter_fn = None
-		if cat != "*":
-			filter_fn = lambda x: x.find(cat+"/")==0
 
+		cat = opts["category"]
 		if not Config["piping"] and Config["verbosityLevel"] >= 3:
 			print_info(3, "[ Searching for file(s) " + pp.regexpquery(",".join(query)) + " in " + pp.cpv(cat) + "... ]")
 		
 		matches = portage.db["/"]["vartree"].dbapi.cpv_all()
-		#matches = gentoolkit.find_all_installed_packages(filter_fn)
+		if cat != "*":
+			matches = (x for x in matches if x.startswith(cat))
 
 		found = 0
 

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2009-02-08  6:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-08  5:07 [gentoo-portage-dev] equery: deprecate --category filtering in belongs Douglas Anderson
2009-02-08  5:21 ` Brian Harring
2009-02-08  6:30 ` Brian Harring [this message]
2009-02-08  7:05   ` Douglas Anderson
2009-02-08 16:11     ` Michael A. Smith
2009-02-09  2:26       ` Douglas Anderson

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=20090208063015.GB4076@hrair \
    --to=ferringb@gmail.com \
    --cc=gentoo-portage-dev@lists.gentoo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox