[PATCH 3 of 3] store: use parsers.lowerencode if available

Adrian Buehlmann adrian at cadifra.com
Fri Oct 5 04:41:28 CDT 2012


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1349429549 -7200
# Node ID e93c452610bcd7e5ba0e5ed835d3fa2f1712d93e
# Parent  a6e1ed39d74a79bfb3a6e0e04120c551ea3c06eb
store: use parsers.lowerencode if available

For the netbeans repo on Windows 7 x64:

Before:

  $ hg perffncacheencode
  ! wall 0.853000 comb 0.858006 user 0.858006 sys 0.000000 (best of 12)

After:

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

This is 27% faster.

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -132,7 +132,9 @@
         cmap[chr(x)] = chr(x).lower()
     return lambda s: "".join([cmap[c] for c in s])
 
-lowerencode = _buildlowerencodefun()
+lowerencode = getattr(parsers, 'lowerencode', None)
+if lowerencode is None:
+    lowerencode = _buildlowerencodefun()
 
 # Windows reserved names: con, prn, aux, nul, com1..com9, lpt1..lpt9
 _winres3 = ('aux', 'con', 'prn', 'nul') # length 3


More information about the Mercurial-devel mailing list