promoting Perl (was Re: uutraffic report (in perl))

J Greely jgreely at giza.cis.ohio-state.edu
Thu Nov 30 04:26:05 AEST 1989


In article <411 at jhereg.Minnetech.MN.ORG> mark at jhereg.Minnetech.MN.ORG (Mark H. Colburn) writes:
>	find <path> <pattern> -print | xargs <any command>
>I would venture to say that the xargs version may actually be faster than
>the perl version.

Well, a quick test on a smallish (~200K) directory tree says that
xargs doesn't always win.

	find . -type f -print | xargs rm -f
vs.
	find . -type f -print | perl -ne 'chop;unlink;'

Perl came out about 25% faster in this particular case.  I believe the
biggest problem with xargs is sub-optimal buffering.


  Now, if everyone would stop mentioning xargs as the "obvious"
solution, we'll all be happier.  One, it's not always the most
efficient.  Two, it's not universally supplied (not on *my* BSD 4.3
tape).  Three, the whatis line for xargs doesn't jump out at a novice
user.  It *might* be clear enough for some, but it might not.

	  xargs	- construct argument list(s) and execute command

--
J Greely (jgreely at cis.ohio-state.edu; osu-cis!jgreely)



More information about the Alt.sources.d mailing list