[PATCH 1 of 1] store: optimize fncache._write by direncoding the contents in one go

Adrian Buehlmann adrian at cadifra.com
Mon Sep 17 02:07:21 CDT 2012


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1347865115 -7200
# Node ID 0752ab09d3ad9a895b47aa75ae3680364130bd9e
# Parent  e7302c90c06661a5465194506f004696dacc26ca
store: optimize fncache._write by direncoding the contents in one go

For a netbeans clone on Windows 7 x64:

  Before:
    $ hg perffncachewrite
    ! wall 0.210000 comb 0.218401 user 0.202801 sys 0.015600 (best of 47)

  After:
    $ hg perffncachewrite
    ! wall 0.104000 comb 0.109201 user 0.078000 sys 0.031200 (best of 95)

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -348,7 +348,7 @@
     def _write(self, files, atomictemp):
         fp = self.opener('fncache', mode='wb', atomictemp=atomictemp)
         if files:
-            fp.write('\n'.join(map(encodedir, files)) + '\n')
+            fp.write(encodedir('\n'.join(files) + '\n'))
         fp.close()
         self._dirty = False
 


More information about the Mercurial-devel mailing list