Patchwork [04,of,13] revlog: early return in _slicechunk when span is already small enough

login
register
mail settings
Submitter Boris Feld
Date July 10, 2018, 1:27 p.m.
Message ID <88131bca12f52021ee6a.1531229233@FB-lair>
Download mbox | patch
Permalink /patch/32743/
State Accepted
Headers show

Comments

Boris Feld - July 10, 2018, 1:27 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1531220254 -7200
#      Tue Jul 10 12:57:34 2018 +0200
# Node ID 88131bca12f52021ee6ab0048df4a10146cbd962
# Parent  639f8b092c12960f1a5f196326149099f98eb8db
# EXP-Topic write-for-sparse-read
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 88131bca12f5
revlog: early return in _slicechunk when span is already small enough

If the full span is smaller than the minimum gap size we'll consider, we know we
won't do any slicing and we can return earlier.

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -227,6 +227,10 @@  def _slicechunk(revlog, revs):
     endbyte = start(revs[-1]) + length(revs[-1])
     readdata = deltachainspan = endbyte - startbyte
 
+    if deltachainspan <  revlog._srmingapsize:
+        yield revs
+        return
+
     chainpayload = sum(length(r) for r in revs)
 
     if deltachainspan: