in reply to Optimizing performance for script to traverse on filesystem
The OP code might be a little more streamlined at run-time by using
instead of loading all directory entries into an array.while ( my $name = readdir( DIR )) { ... }
In case it helps, here's a similar "hand-rolled" recursive traversal script: Get useful info about a directory tree -- it produces different results from what you want, but the basic recursion part is pretty much the same as yours. I even benchmarked it against a File::Find approach, which took noticeably longer to run, possibly due to the number of subroutine calls per directory entry that File::Find does.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Optimizing performance for script to traverse on filesystem
by Marshall (Canon) on Feb 02, 2012 at 07:46 UTC | |
by graff (Chancellor) on Feb 03, 2012 at 04:34 UTC | |
|
Re^2: Optimizing performance for script to traverse on filesystem
by gdanenb (Acolyte) on Feb 02, 2012 at 06:37 UTC | |
by GrandFather (Saint) on Feb 02, 2012 at 22:19 UTC |