Vladimir Chukharev wrote:
On Tue, 29 Jul 2008 23:13:44 +0300, Doug Barton <[EMAIL PROTECTED]>
wrote:

V.Chukharev wrote:
Another patch, just one line. It can be applied independently
from the patch for bsd.port.subdir.mk.
I use: grep -l "@comment ORIGIN:${1}$" $pdb/*/+CONTENTS for
similar purposes in portmaster with no complaints so far. Is
there a reason you need to do the complicated thing?

I am a bit worried by the size of * expansion.

I'm starting to wonder if you've actually tested and/or benchmarked
this stuff. I've run tests of the construction above for 5,000
directories which is way more ports than a user would ever have
installed. Rerunning this contrived example:

 101$ time grep -l doug /home/dougb/testglob/*/file
/home/dougb/testglob/4785/file
real    0m0.718s
user    0m0.026s
sys     0m0.690s

time find /home/dougb/testglob/* -type f -name file -exec grep -l doug
{} \;
/home/dougb/testglob/4785/file
real    0m26.344s
user    0m1.706s
sys     0m22.771s

Piping to xargs instead of using -exec is actually quite a bit faster, roughly 3.5 seconds wall clock time using the same setup (post caching).

Those are the "best case" scenarios with everything cached. Very
first run of the grep test (nothing in the file cache):
time grep -l doug /home/dougb/testglob/*/file
/home/dougb/testglob/4785/file
real    0m6.454s
user    0m0.114s
sys     0m2.992s

I have about 1380 ports installed, and this number can grow. One
example of this kind limitation: $ ls /usr/ports/*/* | wc bash:
/bin/ls: Argument list too long

Sorry, that's a ridiculous example. We have over 18,000 ports, and you're talking about two layers of globals, not one.

That's the reason for find. And it is 5-30 times faster then grep
-r

I didn't say anything about grep -r, look carefully at what I wrote.

(depending on existence and size of /var/pkg/db/pkgdb.db).

... which is why the command I pasted above skips it altogether.

As to the rest of the command - I do not want to mess with it yet.
It works.

I think you need to read des' rules on optimization, especially the bit about not doing optimization unless you're doing extensive benchmarking.

Doug

--

    This .signature sanitized for your protection

_______________________________________________
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to