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

Re: Inefficient stat-ing of files?

Thread Previous | Thread Next
From:
Zefram
Date:
June 24, 2016 15:29
Subject:
Re: Inefficient stat-ing of files?
Message ID:
20160624152857.GF1170@fysh.org
David Farrell wrote:
>I used strace on a Perl one liner and found that 12% of the time was spent
>stat-ing files like this:

Was it enough time to make it appreciably less responsive?  We're not
usually interested in high proportions of very short runtimes.  Also,
if you're measuring with strace, you're probably counting a lot of
per-syscall tracing overhead: with Linux's dentry caches, the actual
stat operations are pretty quick.

>                          have you considered using the directory of the
>most recent successful stat rather than cycling through directories in the
>same order?

Wouldn't help.  If a file is quickly discovered in a later @INC dir,
all the earlier ones still need to be statted, because the guaranteed
behaviour is to load the file from the earliest @INC dir where a file
of that name can be found.

-zefram

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