[PATCH 4 of 6 v6 lazy-manifest] manifest: use custom C implementation of lazymanifest

Augie Fackler raf at durin42.com
Sat Mar 7 11:16:19 CST 2015


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1425695387 18000
#      Fri Mar 06 21:29:47 2015 -0500
# Node ID 821f59a10986d380352d4f88f65f9398e3671d4e
# Parent  74e64852b07f9cfb5a7b89d827dd9e1f01314b1b
manifest: use custom C implementation of lazymanifest

This version is actually lazy, unlike the pure-python version. The
latter could stand to be optimized if anyone actually wants to use it
seriously. I put no work into it.

Before any of my related changes on mozilla-central:

perfmanifest tip
! wall 0.268805 comb 0.260000 user 0.260000 sys 0.000000 (best of 37)
perftags
! result: 162
! wall 0.007099 comb 0.000000 user 0.000000 sys 0.000000 (best of 401)
perfstatus
! wall 0.415680 comb 0.420000 user 0.260000 sys 0.160000 (best of 24)
hgperf export tip
! wall 0.142118 comb 0.140000 user 0.140000 sys 0.000000 (best of 67)

after all of my changes on mozilla-central:

./hg:
perfmanifest tip
! wall 0.232640 comb 0.230000 user 0.220000 sys 0.010000 (best of 43)
perftags
! result: 162
! wall 0.007057 comb 0.010000 user 0.000000 sys 0.010000 (best of 395)
perfstatus
! wall 0.415503 comb 0.420000 user 0.280000 sys 0.140000 (best of 24)
hgperf export tip
! wall 0.025096 comb 0.030000 user 0.030000 sys 0.000000 (best of 102)

so it's no real change in performance on perf{manifest,tags,status},
but is a huge win on 'hgperf export tip'.

There's a little performance work that could still be done here:
fastdelta() could be done significantly more intelligently by using
the internal state of the lazymanifest type in C, but that seems like
good future work.

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -88,6 +88,11 @@ class _lazymanifest(dict):
         return ''.join("%s\0%s%s\n" % (
             f, _hex(n[:20]), flag) for f, n, flag in fl)
 
+try:
+    _lazymanifest = parsers.lazymanifest
+except AttributeError:
+    pass
+
 class manifestdict(object):
     def __init__(self, data=''):
         self._lm = _lazymanifest(data)


More information about the Mercurial-devel mailing list