revlog: early return in _slicechunk when density is already good
authorPaul Morelle <paul.morelle@octobus.net>
Tue, 19 Jun 2018 15:03:58 +0200
changeset 38634 f0ea8b847831
parent 38633 e3d18de56417
child 38635 d083ae26c325
revlog: early return in _slicechunk when density is already good We don't need to do anything if we know we won't enter the second while loop. Save the overhead of the first loop by returning earlier.
mercurial/revlog.py
--- a/mercurial/revlog.py	Tue Jul 10 02:33:43 2018 +0200
+++ b/mercurial/revlog.py	Tue Jun 19 15:03:58 2018 +0200
@@ -234,6 +234,10 @@
     else:
         density = 1.0
 
+    if density >= revlog._srdensitythreshold:
+        yield revs
+        return
+
     # Store the gaps in a heap to have them sorted by decreasing size
     gapsheap = []
     heapq.heapify(gapsheap)