Performance regression on case-insensitive filesystems (Windows)

Matt Mackall mpm at selenic.com
Fri Jul 20 13:35:56 CDT 2012


On Wed, 2012-07-18 at 01:00 +0200, Martin Geisler wrote:
> Hi guys,
> 
> I'm looking into why Mercurial is slow on a repository with 75k tracked
> files and 47k ignored files. With a warm cache, I get

Try this patch, which simply copies a performance hack I did earlier in
encoding.lower():

diff -r d1b49b02bc16 mercurial/encoding.py
--- a/mercurial/encoding.py	Thu Jul 19 21:20:56 2012 +0200
+++ b/mercurial/encoding.py	Fri Jul 20 13:28:30 2012 -0500
@@ -189,6 +189,10 @@
 def upper(s):
     "best-effort encoding-aware case-folding of local string s"
     try:
+        return s.encode('ascii').lower()
+    except UnicodeError:
+        pass
+    try:
         if isinstance(s, localstr):
             u = s._utf8.decode("utf-8")
         else:

This gives a very substantial improvement under Wine with a kernel repo:

Before:
! result: 13
! wall 3.212000 comb 2.690000 user 0.920000 sys 1.770000 (best of 3)

After:
! result: 13
! wall 0.840000 comb 0.760000 user 0.520000 sys 0.240000 (best of 7)

Please test with 'hg perfstatus' from contrib/perf.py.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list