[PATCH 1 of 3] Add a new function, filesystem_case

Paul Moore p.f.moore at gmail.com
Sat Apr 26 12:05:48 CDT 2008


2008/4/23 Dirkjan Ochtman <dirkjan at ochtman.nl>:
>  Would it be very hard to at least come up with some ballparks on what
>  this will cost in terms of performance for some common commands? If it's
>  very expensive, maybe this stuff should be made optional somehow.

I did some basic timings on my current version (a generic walk using
os.listdir and .lower() to compare - basically what I included in the
posted patch for Windows). The timing depends on the number of
directory levels in the path - some tests using timeit.py:

>python -m timeit -s "import mercurial.util as u" "u.fspath('readme')"
10000 loops, best of 3: 97.2 usec per loop

>python -m timeit -s "import mercurial.util as u"
"u.fspath('mercUrIal/UTIL.py')"
1000 loops, best of 3: 255 usec per loop

>python -m timeit -s "import mercurial.util as u"
"u.fspath('mercurial\hGweb\commoN.py')"
1000 loops, best of 3: 295 usec per loop

I then repeated the test with a version replacing the os.listdir scan
with a win32api.FindFiles call. The results were:

>python -m timeit -s "import testfspath as u" "u.fspath('readme')"
10000 loops, best of 3: 62.8 usec per loop

>python -m timeit -s "import testfspath as u" "u.fspath('mercUrIal/UTIL.py')"
10000 loops, best of 3: 110 usec per loop

>python -m timeit -s "import testfspath as u"
"u.fspath('mercurial\hGweb\commoN.py')"
10000 loops, best of 3: 155 usec per loop

That's quite a serious improvement. On that basis, I've added a
Win32-specific override using this approach to util_win32.py. Thanks
for encouraging me to test this.

Paul.


More information about the Mercurial-devel mailing list