[wellylug] Help in finding a good technical/Linux related bookstore

Bruce Hoult bruce at hoult.org
Wed Jun 13 22:03:45 NZST 2007


On 6/13/07, Andrej <andrej at paradise.net.nz> wrote:
>
> For instance if the machine were to run many of the tasks
> that were to be scripted.  Each invocation of the python
> interpreter will cost you more RAM than awk or sed will.  If
> the task can be done in awk or sed there's no good reason
> to choose the heavy weight alternatives.  Sure, I am happy
> to use perl; but some tasks are simple enough to be accomplished
> in awk (with a ~ 300K memory footprint) or sed (take off another
> 100K?) rather than python or perl (~ 6M footprint on both
> accounts), and with less CPU overhead as well.
>

I've never seen a task that runs faster (that is, uses less CPU) in awk or
sed than in perl.  And I've benchmarked quite a few of them!  Even something
as simple as awk '{print $5}' runs faster as perl -lane 'print $F[4]', even
on tiny files.

Anything that you think you want to do in a combination of sh, awl, and sed
is far better done in Perl.

If you have existing awk or sed, run them through a2p or s2p (which have
come with Perl forever).  They'll run faster.  And you can add features more
easily.

If the program is going to be more than a few dozen lines then you're better
off again in Ruby, which deals with regexps and so forth as neatly as Perl,
and classes and OO stuff as well as Python.  And has proper lambdas too.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wellylug.org.nz/pipermail/wellylug/attachments/20070613/64d1f6e6/attachment.htm 


More information about the wellylug mailing list