<div><span class="gmail_quote">On 6/13/07, <b class="gmail_sendername">Andrej</b> &lt;<a href="mailto:andrej@paradise.net.nz">andrej@paradise.net.nz</a>&gt; 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.&nbsp;&nbsp;Each invocation of the python<br>interpreter will cost you more RAM than awk or sed will.&nbsp;&nbsp;If<br>the task can be done in awk or sed there&#39;s no good reason
<br>to choose the heavy weight alternatives.&nbsp;&nbsp;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&#39;ve never seen a task that runs faster (that is, uses less CPU) in awk or sed than in perl. &nbsp;And I&#39;ve benchmarked quite a few of them! &nbsp;Even something as simple as awk &#39;{print $5}&#39; runs faster as perl -lane &#39;print $F[4]&#39;, 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). &nbsp;They&#39;ll run faster. &nbsp;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&#39;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. &nbsp;And has proper lambdas too.
</div><div><br class="webkit-block-placeholder"></div>