Patchwork [10,of,10] sparse-revlog: only consider the span of the delta section

login
register
mail settings
Submitter Boris Feld
Date Aug. 16, 2018, 1:43 p.m.
Message ID <6919d3344c2bb0cb60c9.1534426997@FB-lair>
Download mbox | patch
Permalink /patch/33787/
State Accepted
Headers show

Comments

Boris Feld - Aug. 16, 2018, 1:43 p.m.
# HG changeset patch
# User Paul Morelle <paul.morelle@octobus.net>
# Date 1532085601 -7200
#      Fri Jul 20 13:20:01 2018 +0200
# Node ID 6919d3344c2bb0cb60c97fb3dfef334bfd122517
# Parent  ac0ba18eb49da2b7dc564afb1abec260cd1541d4
# EXP-Topic sparse-snapshot
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 6919d3344c2b
sparse-revlog: only consider the span of the delta section

Since the number of snapshots is limited we can exclude them from the logic
checking size and number of reads. Limiting the span computation to the delta
section will allow for further optimization.

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2500,6 +2500,11 @@  class revlog(object):
             else:
                 deltachain = []
 
+            # search for the first non-snapshot revision
+            for idx, r in enumerate(deltachain):
+                if not self.issnapshot(r):
+                    break
+            deltachain = deltachain[idx:]
             chunks = _slicechunk(self, deltachain, deltainfo)
             distance = max(map(lambda revs:_segmentspan(self, revs), chunks))
         else: