[MERGE] Use win32file.FindFiles instead of os.lstat when available

John Arbash Meinel john at arbash-meinel.com
Thu Jun 26 18:28:59 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel wrote:
| Attached is an optional optimizer when running on windows. I was working
| in a moderately sized tree (~9k files+dirs), and I noticed that "bzr
| status" was a bit slower than I would have expected. When I did
| --lsprof, all the time was taken in "nt.lstat". I checked around and saw
| that pywin32 exposes the FindFiles api, which will return the directory
| entries and their stat info as you go.
|
| In my testing, it makes things faster. Somewhere between 2-4x for the
| time spent it walkdirs. It also seems to do interesting things with
| caching. Because after I've run status with this code a couple of times,
| it makes the plain "bzr status" faster, though still not as fast.
|
| Anyway, abstractions are great, as this lets me slip in a more optimized
| version for walking win32 paths. (And yes, this shouldn't be my primary
| focus, but it was getting in my way and I wanted it to be better.)
|
| John
| =:->

BB:resubmit

It seems there is a bug in my "time" handling here. As near as I can
tell "os.lstat(path)" returns a time 5 hours earlier than that returned
by "FindFiles". Presumably this is because of timezone issues.

The time shown by Explorer is at -5, the time shown by FindFiles is not.

I'll need to resolve this before this is usable. What is weird, is that
on first access, it causes us to re-read all files to check the sha1.
After that, the cache seems perfectly happy for both bzr.dev and my bzr.
That is probably the weirdest part. If my code was wrong, I would expect
them to always disagree, and keep changing the mtime stored in the
dirstate file.

Anyway I'm working on it, hopefully it will be easy to fix.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhj0dsACgkQJdeBCYSNAAO4oACfRLjIOR9KF8zpuSxhsZNjmYa8
aC4AniqraRYKhET1R87jarSuLEQVZBnq
=ZKqV
-----END PGP SIGNATURE-----



More information about the bazaar mailing list