[OT] - subthread - perl vs sed Re: [olug] Text search and Replace

mØntar3 m0ntar3 at cox.net
Sat Nov 29 17:18:33 UTC 2003


Perhaps, the smaller 'perl' is built dynamically, with all its guts 
packed in '.so' files (shared object files). If built statically, then 
all the guts go in actual executeable file, and are no loaded up at 
runtime. "ld -Bdynamic" verses "ld -Bstatic", and "man ld" for the 
excrustainting details.

Assume some hypothetical program's execuateable file is 1 meg and all 
its routines are packed in a shared object file (a '.so') that is 2 meg. 
If a user executes 50,000 instances of the that program simulateanously, 
how much memory is needed? It's something on the order of 50000 + 2 = 
50002 megabytes. If that program is built statically, the environment 
would need something on the order of 50000 * 3 = 150,000 megabytes of 
memory.

Ie. More effeicient use of the environment saves $$$. Caveat: Knowledge 
Is Required. Like, what if your shared objects reside on a mount point 
that failed to load due to a system failure?

Unix systems store share objects in a

Christopher Cashell wrote:

>At Tue, 25 Nov 03, Unidentified Flying Banana Terry, said:
>  
>
>>Interesting:
>>    
>>
>
>Yes, very interesting.
>
>  
>
>>[rockstar at theshow local]$ ls -l /usr/bin/perl
>>-rwxr-xr-x    2 root     root        12800 Oct 15
>>10:17 /usr/bin/perl
>>[rockstar at theshow local]$ ls -l /bin/sed
>>-rwxr-xr-x    1 root     root        87260 Oct 25
>>00:12 /bin/sed
>>    
>>
>
>Hrm. . . I wonder if that /usr/bin/perl binary is some sort of wrapper
>program, or something, possibly calling the real Perl binary to do the
>work (might be something to aid with dependencies).  That's the only way
>I can think of that the perl binary could be that small.
>
>I got results[1] closer to what was posted earlier, with Perl being
>*much* larger than sed, and that goes along with my experience, as well.
>Perl is known for being very powerful, but it hasn't been a lightweight
>interpreter for a *long* time (As even the developers will tell you (and
>is one of the many reasons for Perl6/Parrot's development)).
>
>Perl is a great tool, as are sed and awk.  They each have their place
>and strengths. ;-)
>
>
> [1] Debian/Unstable:
>     -rwxr-xr-x    2 root     root      1126956 Oct 24 08:03 /usr/bin/perl
>     -rwxr-xr-x    1 root     root        36280 Oct 26 19:54 /bin/sed
>     -rwxr-xr-x    1 root     root       254668 Sep  8 19:19 /usr/bin/gawk
>     -rwxr-xr-x    1 root     root        86616 May 30 09:27 /usr/bin/mawk
>     For comparison purposes, I also included two of the most common awk
>     clones.  Perl is v5.8.1, sed is GNU sed 4.0.7.  Results of a check
>     of NetBSD showed almost identical results to the FreeBSD ones
>     posted earlier.
>
>  
>



More information about the OLUG mailing list