[PATCH] improve performance of stat() operations (e.g. ls -lR )

Don Bowman don@sandvine.com
Sun May 26 17:08:00 GMT 2002

Christopher Faylor wrote:
>On Sun, May 26, 2002 at 05:50:13PM -0400, Don Bowman wrote:
>>The attached patch adds a new CYGWIN environment variable, statquery. 

>You should get the same effect by mounting directories or files with
>either the -E or -X option.  And, the control is more pinpoint than an
>environment variable.

Nope. The behaviour comes from the NT CreateFile() operation, as
observed with ntfilemon (from www.sysinternals.com). That single
system call opens the file, reads a bunch of (random) data from
different offsets. Neither the -E nor the -X to mount has 
any affect on this.

For interests sake, here's a (non-scientific :) benchmark:
The cygwin source code (cvs co winsup) ls -lR takes:

57.171s (default options)
 4.462s (new 'statquery' option)
44.002s (mount -E option)
45.171s (mount -X option)

each run was done twice, and the 2nd number taken (to avoid system 

You are perhaps correct that making this a mount option rather than
an env variable would be a good way to go. Its not clear to me why 
the file is being opened for read during that stat anyway.

More information about the Cygwin-patches mailing list