From patchwork Sat Oct 10 08:47:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3, of, 3] revlog: prevent recreating a tuple again and again for each rev From: Pulkit Goyal <7895pulkit@gmail.com> X-Patchwork-Id: 47435 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sat, 10 Oct 2020 14:17:24 +0530 # HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1602252446 -19800 # Fri Oct 09 19:37:26 2020 +0530 # Node ID a96cd3eebf8eba04a351615728c9635e8941af10 # Parent 911cea33820c98da3fa2e4891153e674600df1af # EXP-Topic sidedata-upgrade revlog: prevent recreating a tuple again and again for each rev I am tracking a memory leak during upgrade which does revlog cloning. Although this does not make much of difference but seemed like a nice change to me. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -2773,6 +2773,7 @@ class revlog(object): sidedatachanges = sidedatacompanion is not None deltacomputer = deltautil.deltacomputer(destrevlog) index = self.index + defsidedataactions = (False, (), {}) for rev in self: entry = index[rev] @@ -2784,9 +2785,10 @@ class revlog(object): p2 = index[entry[6]][7] node = entry[7] - sidedataactions = (False, [], {}) if sidedatachanges: sidedataactions = sidedatacompanion(self, rev) + else: + sidedataactions = defsidedataactions # (Possibly) reuse the delta from the revlog if allowed and # the revlog chunk is a delta.