I was looking through the source and noticed there are many instances in the code where a regex is used for relatively simple strings checks. Something like $other->[PATH] =~ m{^\Q$self->[PATH]\E} would be faster with: ! rindex $other->[PATH], $self->[PATH], 0. And something like $new_mode =~ /[=+-]/ should be $newmode =~ tr/=+-//. Even some of the substitution regex are minor enough to use substr.
Tiny code doesn't necessitate slower code.
P.S. I noticed this bit in relative which does unecessary work when $base->is_rootdir:
$base = "" if $base->is_rootdir;
my $relative = "$self";
$relative =~ s{\A\Q$base/}{};
I was looking through the source and noticed there are many instances in the code where a regex is used for relatively simple strings checks. Something like
$other->[PATH] =~ m{^\Q$self->[PATH]\E}would be faster with:! rindex $other->[PATH], $self->[PATH], 0. And something like$new_mode =~ /[=+-]/should be$newmode =~ tr/=+-//. Even some of the substitution regex are minor enough to usesubstr.Tiny code doesn't necessitate slower code.
P.S. I noticed this bit in
relativewhich does unecessary work when$base->is_rootdir: