[PATCH 4 of 8] revlog: more efficient implementation for issnapshot
Yuya Nishihara
yuya at tcha.org
Mon Dec 17 09:14:57 EST 2018
On Mon, 17 Dec 2018 12:00:46 +0000, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1545040296 -3600
> # Mon Dec 17 10:51:36 2018 +0100
> # Node ID 9fe9cc49f235311269fd957c49898396ed7bdfc0
> # Parent 4cafb262b243b02c217fb538165e354f77ce0fd8
> # EXP-Topic sparse-revlog-corner-cases
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 9fe9cc49f235
> revlog: more efficient implementation for issnapshot
>
> We avoid multiple method calls and tuple creation, this provides a significant
> speedup in some case:
>
> example affected manifest write
> before: 0.815520s
> after: 0.487767s (-40%)
>
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -1535,11 +1535,17 @@ class revlog(object):
> """
> if rev == nullrev:
> return True
> - deltap = self.deltaparent(rev)
> + entry = self.index[rev]
> + deltap = entry[3]
> + if deltap == rev:
> + return True
> + if not self._generaldelta:
> + return False
I'm not sure if I understand it correctly, but before, deltap was rev - 1
if generaldelta off, and if it wasn't p1 nor p2, issnapshot() would be
called recursively.
> if deltap == nullrev:
> return True
> - p1, p2 = self.parentrevs(rev)
> - if deltap in (p1, p2):
> + p1 = entry[5]
> + p2 = entry[6]
> + if deltap == p1 or deltap == p2:
> return False
> return self.issnapshot(deltap)
>
More information about the Mercurial-devel
mailing list