[PATCH 6 of 6 A2 series] store: use parsers.dotauxencode

Adrian Buehlmann adrian at cadifra.com
Sat Oct 6 09:52:27 UTC 2012


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1349515629 -7200
# Node ID 0ceddcdb535e9f991d1185905c3e12dc13bc9bf0
# Parent  5ad5ecf11d72f5a44100ababfd5a50f1cf112c91
store: use parsers.dotauxencode

This would additionally bring netbeans down from

  $ hg perffncacheencode
  ! wall 0.617000 comb 0.624004 user 0.624004 sys 0.000000 (best of 17)

to

  $ hg perffncacheencode
  ! wall 0.488000 comb 0.483603 user 0.483603 sys 0.000000 (best of 21)

(another 20% speedup)

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -183,14 +183,22 @@
             path[i] = n[:-1] + "~%02x" % ord(n[-1])
     return path
 
+def _pydotauxencode(path):
+    return '/'.join(_auxencode(path.split('/'), True))
+
+_dotauxencode = getattr(parsers, 'dotauxencode', _pydotauxencode)
+
 _maxstorepathlen = 120
 _dirprefixlen = 8
 _maxshortdirslen = 8 * (_dirprefixlen + 1) - 4
 
 def _hashencode(path, dotencode):
     digest = _sha(path).hexdigest()
-    le = lowerencode(path).split('/')[1:]
-    parts = _auxencode(le, dotencode)
+    le = lowerencode(path)
+    if dotencode:
+        parts = _dotauxencode(le).split('/')[1:]
+    else:
+        parts = _auxencode(le.split('/')[1:], dotencode)
     basename = parts[-1]
     _root, ext = os.path.splitext(basename)
     sdirs = []



More information about the Mercurial-devel mailing list