I was doing some profiling on ack the other night. What I found was amazing. For the simple call:
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.ack foo ~/big-tree-of-source
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.
xoxo,
Andy
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: File::Basename is dog slow
by runrig (Abbot) on Dec 19, 2006 at 19:30 UTC | |
by tye (Sage) on Dec 19, 2006 at 20:35 UTC | |
by petdance (Parson) on Dec 20, 2006 at 06:03 UTC | |
by tye (Sage) on Dec 20, 2006 at 06:59 UTC | |
Re: File::Basename is dog slow
by rinceWind (Monsignor) on Dec 20, 2006 at 11:12 UTC | |
by petdance (Parson) on Dec 20, 2006 at 15:52 UTC |
Back to
Meditations