On Sun, Feb 10, 2013 at 8:26 PM, demerphq [off-list ref] wrote:
On 10 February 2013 12:17, Duy Nguyen [off-list ref] wrote:
quoted
Bear in mind though this is Linux, where lstat is fast. On systems
with slow lstat, these timings could look very different due to the
large number of lstat calls compared to open+getdents. I really like
to see similar numbers on Windows.
Is windows stat really so slow?
I can't say. I haven't used Windows for months (and git on Windows for years)..
I encountered this perception in
windows Perl in the past, and I know that on windows Perl stat
*appears* slow compared to *nix, because in order to satisfy the full
*nix stat interface, specifically the nlink field, it must open and
close the file*. As of 5.10 this can be disabled by setting a magic
var ${^WIN32_SLOPPY_STAT} to a true value, which makes a significant
improvement to the performance of the Perl level stat implementation.
I would not be surprised if the cygwin implementation of stat() has
the same issue as Perl did, and that stat appears much slower than it
actually need be if you don't care about the nlink field.
The native port of git uses get_file_attr (in
compat/mingw.c:do_lstat()) to simulate lstat and always sets nlink to
1. I assume this means git does not care about nlink field. I don't
know about cygwin though.
Yves
* http://perl5.git.perl.org/perl.git/blob/HEAD:/win32/win32.c#l1492
--
Duy