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

Re: Inefficient stat-ing of files?

Thread Previous | Thread Next
From:
Craig A. Berry
Date:
June 24, 2016 16:50
Subject:
Re: Inefficient stat-ing of files?
Message ID:
CA+vYcVwhaZ_vFGnMv8nwoOSGcZY8tEOW97+oH=hmwL++9zXswg@mail.gmail.com
On Thu, Jun 23, 2016 at 9:16 PM, David Farrell <davidnmfarrell@gmail.com> 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 strict.pm, why not grab warnings.pm
from the same place rather than starting over?

But what if somebody has an override for strict.pm in site_perl
(unlikely in this particular case but the general principle holds) and
then assumes warnings.pm can be loaded directly from there but it
doesn't exist there?  Or the reverse case where we get strict.pm from
the default location and load warnings.pm 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About