in reply to Re: Wondering about File::Find
in thread Wondering about File::Find
The advantage of chdir(), at least on some systems, is that the whole path doesn't need to be traversed for each directory and file access. If you don't chdir(), then you are doing things like stat("sub/dir/tiny/file") which, even if the cache works very effectively, has to find "sub", then find "dir", then find "tiny", then find "file".
If you chdir(), then your process keeps a handle into that directory so that stat("file") doesn't have to even look in the cache for "sub", "dir", and "tiny". I'd be interested to see benchmarks on what practical effect this can have on the whole process.
- tye (but my friends call me "Tye")
|
|---|