I'm traversing an entire partition, stat()
'ing each file and then checking the returned values for mtime, size and uid against hashed values. stat()
however is far too slow in Perl and I'm wondering if there's any quicker alternatives I may be overlooking.
When you call stat
you're querying the filesystem and will be limited by its performance. For large numbers of files this will be slow; it's not really a Perl issue.
Before you go off optimizing stat, use Devel::NYTProf to see where the real slow-down is.
Also, investigate the details of how you've mounted the filesystem. Is everything local, or have you mounted something over NFS or something similar? There are many things that can be the problem, as other answers have pointed out. Don't spend too much time focussing on any potential problem until you know it's the problem.
Good luck,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With