develooper Front page | perl.perl5.porters | Postings from June 2016

Re: Inefficient stat-ing of files?

Thread Previous | Thread Next
Craig A. Berry
June 24, 2016 16:50
Re: Inefficient stat-ing of files?
Message ID:
On Thu, Jun 23, 2016 at 9:16 PM, David Farrell <> wrote:

> In these cases Perl was stat-ing 7 files for every 1 file that existed. I'm
> no systems programmer but have you considered using the directory of the
> most recent successful stat rather than cycling through directories in the
> same order? I wonder if that could save startup time, particularly for
> programs with hundreds of dependencies.

If I'm following you, you're saying when we've just iterated through
the canonical locations and found, why not grab
from the same place rather than starting over?

But what if somebody has an override for in site_perl
(unlikely in this particular case but the general principle holds) and
then assumes can be loaded directly from there but it
doesn't exist there?  Or the reverse case where we get from
the default location and load from the same place,
meanwhile missing the override in site_perl or an
architecture-specific directory.

I think it's an area worth investigating, i.e., how much time (if any)
do we spend looking for files we know we'll never find, but it's not
easy to short-circuit the existing method without breaking things.

I was surprised to see all the searches for .pmc files since as far as
I know there is no complete and reliable bytecode compiler for Perl 5.
It looks like we could cut the number of stat calls when loading
modules in about half by removing the checks for .pmc files.
Figuring out whether eliminating those has a measurable performance
benefit might be worth a look.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About