Re: Is there a lua module just like GNU's find?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Is there a lua module just like GNU's find?
- From: Joshua Jensen <josh.jjensen@...>
- Date: 2011年12月17日 09:16:46 -0700
----- Original Message -----
From: Dimiter 'malkia' Stanev
Date: 12/16/2011 12:00 PM
There is a way to read the directory in just 2-3 kernel calls. (A
little more if the directory is bigger, and provided buffer is not
enough). I can't tell whether it's faster, but it's out there.
fileinfo.c:
https://gist.github.com/1487388
FYI: It's doing more that it's supposed to do, for example two times
calling
if(!GetFileInformationByHandleEx(h, (FILE_INFO_BY_HANDLE_CLASS)i,
buffer1, sizeof(buffer1))
|| !GetFileInformationByHandleEx(h, (FILE_INFO_BY_HANDLE_CLASS)i,
buffer2, sizeof(buffer2)))
continue;
but this was just to explore how the functions were behaving, and
whether they were filling the buffer to the end.
Only one call is needed there.
This is very cool. If it is faster (and it has the logical appearance
of being so), then applications could detect the Windows platform and
choose to use it on Vista [1] and above.
I wonder if Git's scanning internals could be sped up with this...?
Thanks!
Josh
[1]
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364953(v=vs.85).aspx