You can save a little overhead by reusing the stat buffer using the magical filehandle '_',
Yes and no. You can do that if you first disable File::Find's overeager "optimization" via:
If you don't do that first, then File::Find will skip doing lstat in some cases and your use of _ will give you stale data (data for the wrong file) in those cases.$File::Find::dont_use_nlink= 1;
I'd much rather you have to request this optimization when you want it (which, on some file systems, can speed up Find operations where you don't care about anything but the file name), but p5p seems pretty violently against making this "optimization" opt-in instead of opt-out.
- tyeIn reply to Re^3: opendir in file find (anti-optimization effects)
by tye
in thread opendir in file find
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |