Subject: | Cwd::cwd can be slow |
This module is used by CGI::Compile, and its performance seemed slower than expected. It turns out the
code was spending most of its time in Cwd::_backtick_cwd, which is used by Cwd::cwd (at least on
Linux).
Changing the line:
my $orig = cwd;
to
my $orig = File::Spec->curdir;
in the pushd method results in a significant speedup in my benchmark. I'm not a perl portability expert,
but I think that should be just as portable.
I'm using perl 5.10.0 on Linux 2.6, but I don't think this is perl version specific.