perlmeditation
petdance
I was doing some profiling on [http://petdance.com/ack/|ack] the other night. What I found was amazing. For the simple call:
<code>
ack foo ~/big-tree-of-source
</code>
about 48% of the time was in repeated calls to File::Basename::parsefile() to figure out the extension of the file being checked. I replaced it with a simple regex and the run-time cut in half.
<p>
The slowness is undoubtedly aggravated by how the function needs to know a list of all the suffixes that it should look for. Removing the call to File::Basename::parsefile(), I also got to throw away the code that built the suffix list.
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-72812">
<P>
xoxo,<BR>
Andy<BR>
</div></div>