[PATCH RFC] scmutil: 14% speedup in casecollisionauditor

Joshua Redstone joshua.redstone at fb.com
Fri Jul 6 16:08:07 CDT 2012


# HG changeset patch
# User Joshua Redstone <joshua.redstone at fb.com>
# Date 1341608200 25200
# Node ID 29b08870806ee6b94dadea41109fe1da7f6a7e0f
# Parent  2e139644f2b22337ff565e842ca88c0df837ce1d
scmutil: 14% speedup in casecollisionauditor

On a large repository, switching casecollisionauditor to lowercasing all file
names at once rather than one at a time improves hg-add time by 14%.

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -53,8 +53,9 @@
         self._ui = ui
         self._abort = abort
         self._map = {}
-        for f in existingiter:
-            self._map[encoding.lower(f)] = f
+        s = '\0'.join(existingiter._repo.dirstate._map)
+        self._map = dict(zip(encoding.lower(s).split('\0'),
+                             existingiter._repo.dirstate._map))
 
     def __call__(self, f):
         fl = encoding.lower(f)


More information about the Mercurial-devel mailing list