Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Performance wise, the difference between:

#!/usr/bin/env /usr/bin/perl

And:

#!/usr/bin/perl

Is almost nothing on a P3 800Mhz running Linux 2.4.20. Using Benchmark.pm and system("program.pl") the former runs at 3875.97 times per second and the latter runs at 3906.25 times per second. The env binary is only 11 Kbytes and should fit in RAM for any program executed frequently. The env binary also only runs exec(), it does not run fork(), so sensible systems (such as Linux) that do not need to reschedule a timeslice to complete exec() show almost no penalty at all (I suspect the slight penalty is due to the loading of the elf information and performing a dependency analysis of the shared libraries associated with /usr/bin/env).

As I mentioned in my response, one of the reasons why /usr/bin/env would be necessary is the case where perl is network-mounted and a shell script is necessary to select the correct version of perl to execute for the host platform. In this case, the issue is that it would be impossible or impractical to do this sort of thing any other way.

As for portability, env is located in /usr/bin/env on HP-UX, SunOS, Solaris, and Linux. If perl can easily have a symbolic link created at /usr/bin/perl, then env can easily have a symbolic link created at /usr/bin/env on whatever architecture you happen to be referring to that does not have /usr/bin/env.


In reply to Re: •Re: Re: shebang line - foreign to me by MarkM
in thread shebang line - foreign to me by John M. Dlugosz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (5)
    As of 2014-07-29 07:47 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (211 votes), past polls