sparse-revlog: fast-path before computing payload size
authorBoris Feld <boris.feld@octobus.net>
Thu, 08 Nov 2018 15:29:58 +0100
changeset 40606 bfbfd15d65bd
parent 40605 a32ccd32982b
child 40607 54de23400b2a
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.
mercurial/revlogutils/deltas.py
--- 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)