in reply to glob() far slower than `dir`

glob on Win32 can be orders of magnitude slower than it should be. The C code (from bash and/or BSD?) used to implement the default glob does a stat on every single file.

Use a different glob module to work around this problem. For example, just adding "-MFile::DosGlob=glob" should make a big difference.

- tye        

  • Comment on Re: glob() far slower than `dir` (stat--)

Replies are listed 'Best First'.
Re^2: glob() far slower than `dir` (stat--)
by halley (Prior) on Feb 18, 2005 at 20:00 UTC
    Thanks, tye, I've added a dosglob test case to the benchmark. I found that our network performance varies widely, and dosglob and readdir were roughly comparable on most runs. Either one would be preferable to using backticks, of course.

    I didn't realize that DosGlob's version was so different, performance-wise. I figured it was mostly for the extended wildcard support and case-sensitivity issues. The scripts we write must be portable, but since it's available and works on our older Solaris setups, we can use that here, too.

    --
    [ e d @ h a l l e y . c c ]