<div><span class="gmail_quote">On 6/13/07, <b class="gmail_sendername">Andrej</b> <<a href="mailto:andrej@paradise.net.nz">andrej@paradise.net.nz</a>> wrote:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
For instance if the machine were to run many of the tasks<br>that were to be scripted. Each invocation of the python<br>interpreter will cost you more RAM than awk or sed will. If<br>the task can be done in awk or sed there's no good reason
<br>to choose the heavy weight alternatives. Sure, I am happy<br>to use perl; but some tasks are simple enough to be accomplished<br>in awk (with a ~ 300K memory footprint) or sed (take off another<br>100K?) rather than python or perl (~ 6M footprint on both
<br>accounts), and with less CPU overhead as well.<br></blockquote></div><br><div>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.
</div><div><br class="webkit-block-placeholder"></div><div>Anything that you think you want to do in a combination of sh, awl, and sed is far better done in Perl.</div><div><br class="webkit-block-placeholder"></div><div>
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.</div><div><br class="webkit-block-placeholder"></div><div>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.
</div><div><br class="webkit-block-placeholder"></div>