# HG changeset patch # User Gregory Szorc # Date 2016-03-06 22:29:13 # Node ID 959eadae589a2fe7fec205180175434faae13a70 # Parent 8939a95064f11573dd274e511937837ff7f6e25b changelog: lazily parse manifest node Like the description, we store the raw bytes and convert from hex on access. This patch also marks the beginning of our new parsing method, which is based on newline offsets and doesn't rely on str.split(). Many revsets showed a performance improvement: author(mpm) 0.896565 0.869085 0.868598 desc(bug) 0.887169 0.928164 0.910400 extra(rebase_source) 0.865446 0.871500 0.841644 author(mpm) or author(greg) 1.801832 1.791589 1.731503 author(mpm) or desc(bug) 1.812438 1.851003 1.798764 date(2015) or branch(default) 0.968276 0.974027 0.945792 diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -155,7 +155,7 @@ class changelogrevision(object): '_rawdesc', 'extra', 'files', - 'manifest', + '_rawmanifest', 'user', ) @@ -188,8 +188,10 @@ class changelogrevision(object): doublenl = text.index('\n\n') self._rawdesc = text[doublenl + 2:] + nl1 = text.index('\n') + self._rawmanifest = text[0:nl1] + l = text[:doublenl].split('\n') - self.manifest = bin(l[0]) self.user = encoding.tolocal(l[1]) tdata = l[2].split(' ', 2) @@ -211,6 +213,10 @@ class changelogrevision(object): return self @property + def manifest(self): + return bin(self._rawmanifest) + + @property def description(self): return encoding.tolocal(self._rawdesc)