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

Sean Kelly smkelly at zombie.org
Tue Nov 25 20:12:38 UTC 2003


On Tue, Nov 25, 2003 at 11:46:19AM -0800, Terry wrote:
> Another point to make here is the perl binary is 1/4
> the size of the sed binary....

?!?!
-r-xr-xr-x  1 root  wheel   24960 Oct 28 21:11 /usr/bin/sed
-rwxr-xr-x  1 root  wheel  844604 Oct 29 00:24 /usr/local/bin/perl

The perl binary is 33x bigger than sed on my machine.

/usr/bin/sed: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD),
for FreeBSD 5.0.1, dynamically linked (uses shared libs), stripped

/usr/local/bin/perl: ELF 32-bit LSB executable, Intel 80386, version 1
(FreeBSD), for FreeBSD 5.0.1, dynamically linked (uses shared libs), stripped


> 
> Since we are getting to the rediculous point of this
> discussion, I thought it was appropriate.  :)
> 
> 
> --- Jay Hannah <jay at jays.net> wrote:
> > 
> > On Tuesday, November 25, 2003, at 11:20 AM, Brian
> > Roberson wrote:
> > > While I am a huge fan of perl, I must say that it
> > is overkill on 
> > > things like
> > > this, say you had directory with 50,000 files...
> > just think about 
> > > spawning
> > > perl 50,000 time's vice sed plus the overhead that
> > perl would add if 
> > > the
> > > files where 10Mb+ in size. AFAIK - perl would load
> > 10Mb into resident 
> > > mem
> > > before even doing the substitution. sed uses the
> > file control function 
> > > fseek
> > > when you give it a filename instead of standard
> > out.
> > 
> > Blasphemer!  -grin-
> > 
> >     perl -i -e 's/foo/bar/g' myfiles*.txt
> > 
> > Does not spawn 50,000 perl's. There's just one perl
> > whacking the 50,000 
> > files. You could very well be right about 10MB of
> > resident mem. But if 
> > you don't have 10MB of memory free do you really
> > have an appropriate 
> > server for whacking 50,000 10MB+ files? -grin-
> > 
> > I'd take the time to benchmark the speed of "perl
> > -i" vs. sed, but I'm 
> > too lazy*.
> > 
> > Call me a zealot, but IMHO it's a good idea to learn
> > Perl once rather 
> > than learning sed _and_ awk. Learn one thing instead
> > of two, plus you 
> > can then do sooo much more than both combined. Ah,
> > Perl. The Swiss Army 
> > Chainsaw of text processors**.
> > 
> > Jay Hannah
> > Local Perl Zealot
> > Omaha Perl Mongers: http://omaha.pm.org
> > 
> > * ... and impatient, and full of hubris. -grin-
> > ** ... and database manipulators, network service
> > creator/consumers, 
> > etc...
> > 
> > _______________________________________________
> > OLUG mailing list
> > OLUG at olug.org
> > http://lists.olug.org/mailman/listinfo/olug
> 
> 
> =====
> Terry
> 
> __________________________________
> Do you Yahoo!?
> Protect your identity with Yahoo! Mail AddressGuard
> http://antispam.yahoo.com/whatsnewfree
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug

-- 
Sean Kelly         | PGP KeyID: D2E5E296
smkelly at zombie.org | http://www.zombie.org


More information about the OLUG mailing list