[olug] Character Removal

Obi-Wan obiwan at jedi.com
Fri Oct 19 20:45:17 UTC 2007


>> Perl has its uses, but is overly bloated for such a simple operation.
>> Sed(1) does a wonderful job of this sort of thing.
> 
> Overly bloated? Instead of
>    sed -e
> use
>    perl -ple
> 
> and escape any parens outside of []'s.
> 
> Now sed and perl do the exact same thing in your examples.

I'm not referring to the code size.  I'm referring to the amount of
memory and CPU cycles required to fire up a copy of perl vs sed.
Not a big deal if you're only running one by hand on your desktop,
but it makes a larger difference if this is becoming part of a
frequently-used application or is running on an overworked server.
On my Ubuntu 7.04 box, the perl binary is over 1MB, while the sed
binary is just 39KB.  On slower boxes, you can even feel a difference
in the start-up time of a one-off command, especially if the server
is busy doing other things at the same time.

Don't get me wrong; I like perl and use it frequently.  I just know
enough to not use it exclusively.

-- 
Ben "Obi-Wan" Hollingsworth                             obiwan at jedi.com
   The stuff of earth competes for the allegiance I owe only to the
     Giver of all good things, so if I stand, let me stand on the
       promise that You will pull me through.  -- Rich Mullins



More information about the OLUG mailing list