in reply to File::Basename is dog slow
I assume you're talking about this code (from parsefile):
It recompiles a regex for every suffix on every call to parsefile. Yuck! This module could use another function that saves a regex to do the suffix checking (in a closure or an object). Or something :-)if (@suffices) { $tail = ''; foreach $suffix (@suffices) { my $pat = ($igncase ? '(?i)' : '') . "($suffix)\$"; if ($basename =~ s/$pat//s) { $taint .= substr($suffix,0,0); $tail = $1 . $tail; } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: File::Basename is dog slow
by tye (Sage) on Dec 19, 2006 at 20:35 UTC | |
Re^2: File::Basename is dog slow
by petdance (Parson) on Dec 20, 2006 at 06:03 UTC | |
by tye (Sage) on Dec 20, 2006 at 06:59 UTC |
In Section
Meditations