diff mercurial/revlog.py @ 44523:e7fff9c3cdac

rust-nodemap: automatically use the rust index for persistent nodemap The persistent nodemap requires the rust index to be used to provides any gains. So we automatically enable it for revlog using the persistent nodemap. We keep it off for other revset because now that the rust revlog fully initialise the nodemap using it everywhere introduce a fairly significant regression (eg: hg diff moving from 0.8s to 2.3s on mozilla-try) Differential Revision: https://phab.mercurial-scm.org/D8164
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 18 Feb 2020 15:19:11 +0100
parents 87b327de772c
children 6c906eaedd0d
line wrap: on
line diff
--- a/mercurial/revlog.py	Tue Feb 18 18:32:55 2020 +0100
+++ b/mercurial/revlog.py	Tue Feb 18 15:19:11 2020 +0100
@@ -618,12 +618,19 @@
             and NodemapRevlogIO is not None
         )
 
+        use_rust_index = False
+        if rustrevlog is not None:
+            if self.nodemap_file is not None:
+                use_rust_index = True
+            else:
+                use_rust_index = self.opener.options.get(b'rust.index')
+
         self._io = revlogio()
         if self.version == REVLOGV0:
             self._io = revlogoldio()
         elif devel_nodemap:
             self._io = NodemapRevlogIO()
-        elif rustrevlog is not None and self.opener.options.get(b'rust.index'):
+        elif use_rust_index:
             self._io = rustrevlogio()
         try:
             d = self._io.parseindex(indexdata, self._inline)