changeset 41084:84491ae0b3f0

revlog: more efficient implementation for issnapshot We avoid multiple method calls and tuple creation, this provides a significant speedup in some case: example affected manifest write before: 0.815520s after: 0.487767s (-40%)
author Boris Feld <boris.feld@octobus.net>
date Mon, 17 Dec 2018 10:51:36 +0100
parents cbc3cbd9ff93
children a6556b09bf83
files mercurial/revlog.py
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Sun Dec 30 16:14:42 2018 +0100
+++ b/mercurial/revlog.py	Mon Dec 17 10:51:36 2018 +0100
@@ -1535,15 +1535,19 @@
         """
         if rev == nullrev:
             return True
-        deltap = self.deltaparent(rev)
-        if deltap == nullrev:
+        entry = self.index[rev]
+        base = entry[3]
+        if base == rev:
             return True
         elif not self._sparserevlog:
             return False
-        p1, p2 = self.parentrevs(rev)
-        if deltap in (p1, p2):
+        if base == nullrev:
+            return True
+        p1 = entry[5]
+        p2 = entry[6]
+        if base == p1 or base == p2:
             return False
-        return self.issnapshot(deltap)
+        return self.issnapshot(base)
 
     def snapshotdepth(self, rev):
         """number of snapshot in the chain before this one"""