procmail
[Top] [All Lists]

Re: Nevermind (was compiling without a terminal)

2003-08-10 16:30:53
On Sunday, 10 August 2003, at 14:50, Dallman Ross wrote:
On Sun, Aug 10, 2003 at 01:51:10PM -0600, LuKreme wrote:
On Sunday, 10 August 2003, at 12:24, Dallman Ross wrote:

KrispyKream is wrong to say that the -ls option to find is more
efficient; it is not.  Options to find are executed once per
each file found.  Otoh, a pipe to xargs runs the ls command one
time only, on all arguments found.  More efficient, by orders of
magnitude!

| xargs opens a whole other pipe. -ls does not.  One process vs.
multiple processes.  I was taught that one process is better.

Using -ls does appear to be FASTER and doesn't care about spaces in
the path.

No, it's not faster.

...

I got about 18 seconds for

        time find ~ -ls

versus about 14 seconds for

        time ls -ld `find ~`

Well, first you are timing two different things; in the first you are timing find, in the second you are timing ls. We were taking about find versus find with an xargs pipe.

% $ time find . -ls > tempfile1

real    0m1.048s
user    0m0.470s
sys     0m0.480s


% time find . -print0 | xargs -0 ls -ldir > tempfile2

real    0m2.054s
user    0m0.720s
sys     0m1.370s

the system time for -ls is nearly a third of the xargs pipe, and the real time is half.

this is a small directory of only 17,000 files or so. I ran it again on a much larger directory (over 125,000 files and many more directories)


$ time find . -ls > ../tempfile1

real    0m47.193s
user    0m4.810s
sys     0m16.930s

% time find . -print0 | xargs -0 ls -ldir > tempfile2

real    0m59.491s
user    0m9.060s
sys     0m29.560s

only 12 seconds longer real time, but 13 seconds longer for 'sys' which is what really matters.

--
<Athene> we all have our moments when we lose it
<Slyspy> the key is though, to conceal the evidence before the police arrive


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail