Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^5: Myth busted: Shell isn't always faster than Perl

by Perl Mouse (Chaplain)
on Jan 05, 2006 at 12:03 UTC ( #521274=note: print w/replies, xml ) Need Help??


in reply to Re^4: Myth busted: Shell isn't always faster than Perl
in thread Myth busted: Shell isn't always faster than Perl

You're wrong.

xargs is smart enough to deal with that. If the argument list would exceed certain limits (may depend on the system and the build to xargs, for some versions of xargs, limits can be set as parameters), as many copies of the program will be fired up as necessary. Limits exist on the number of arguments, and the total length of the arguments.

Perl --((8:>*
  • Comment on Re^5: Myth busted: Shell isn't always faster than Perl

Replies are listed 'Best First'.
Re^6: Myth busted: Shell isn't always faster than Perl
by polettix (Vicar) on Jan 05, 2006 at 12:35 UTC
    I remembered working on a Sun some time ago where a pipe with xargs gave problems with too many arguments - but I might have dreamt it.

    OT: I'm quite happy of my wrong answer. It taught me that I had wrong expectations about xargs, and that it will work fine in my Linux box. And others will possibly benefit :)

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.
      I remembered working on a Sun some time ago where a pipe with xargs gave problems with too many arguments - but I might have dreamt it.
      If so, then it would be a bug, as that would mean its xargs would not be POSIX compliant. I can't recall ever run into this problem using Solaris (but that doesn't prove anything - my memory isn't perfect). Here's the relevant quote from the POSIX docs:
      The generated command line length shall be the sum of the size in byte +s of the utility name and each argument treated as strings, including a null byte terminator for + each of these strings. The xargs utility shall limit the command line length such that when the c +ommand line is invoked, the combined argument and environment lists (see the exec family of fu +nctions in the System Interfaces volume of IEEE Std 1003.1-2001) shall not exceed {ARG_MAX}- +2 048 bytes. Within this constraint, if neither the -n nor the -s option is specified, the + default command line length shall be at least {LINE_MAX}.
      Perl --((8:>*

      Edited by planetscape - replaced pre with code tags

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://521274]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2020-10-26 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (250 votes). Check out past polls.

    Notices?