changeset 40606:bfbfd15d65bd

sparse-revlog: fast-path before computing payload size In this fast-path case, we do not need to compute the full delta chain payload. Since it comes with a significant cost, we avoid doing so if possible.
author Boris Feld <boris.feld@octobus.net>
date Thu, 08 Nov 2018 15:29:58 +0100
parents a32ccd32982b
children 54de23400b2a
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Tue Oct 16 14:46:28 2018 +0200
+++ b/mercurial/revlogutils/deltas.py	Thu Nov 08 15:29:58 2018 +0100
@@ -257,13 +257,13 @@
         return
 
     deltachainspan = segmentspan(revlog, revs)
-    chainpayload = sum(length(r) for r in revs)
 
     if deltachainspan < mingapsize:
         yield revs
         return
 
     readdata = deltachainspan
+    chainpayload = sum(length(r) for r in revs)
 
     if deltachainspan:
         density = chainpayload / float(deltachainspan)