changeset 45645:7baf5f798ba9

revlog: pre-compute null revlog item for pure version The dynamically created tuple shows up in memory profiles and the use of nullid prevents the normal constant building to work. Differential Revision: https://phab.mercurial-scm.org/D9154
author Joerg Sonnenberger <joerg@bec.de>
date Tue, 06 Oct 2020 02:21:14 +0200
parents 439ce34d81e6
children 1efbc787334c
files mercurial/pure/parsers.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pure/parsers.py	Sun Oct 04 22:17:52 2020 -0700
+++ b/mercurial/pure/parsers.py	Tue Oct 06 02:21:14 2020 +0200
@@ -37,6 +37,7 @@
 indexfirst = struct.calcsize(b'Q')
 sizeint = struct.calcsize(b'i')
 indexsize = struct.calcsize(indexformatng)
+nullitem = (0, 0, 0, -1, -1, -1, -1, nullid)
 
 
 def gettype(q):
@@ -103,7 +104,7 @@
 
     def __getitem__(self, i):
         if i == -1:
-            return (0, 0, 0, -1, -1, -1, -1, nullid)
+            return nullitem
         self._check_index(i)
         if i >= self._lgt:
             return self._extra[i - self._lgt]