Patchwork D9154: revlog: pre-compute null revlog item for pure version

login
register
mail settings
Submitter phabricator
Date Oct. 6, 2020, 12:21 a.m.
Message ID <differential-rev-PHID-DREV-jlyheuxebbjuizl7nnya-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47383/
State Superseded
Headers show

Comments

phabricator - Oct. 6, 2020, 12:21 a.m.
joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The dynamically created tuple shows up in memory profiles and the use of
  nullid prevents the normal constant building to work.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D9154

AFFECTED FILES
  mercurial/pure/parsers.py

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -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]