[PATCH 2 of 8 V3] revlog: more efficient implementation for issnapshot

Yuya Nishihara yuya at tcha.org
Sun Dec 30 03:39:33 EST 2018


On Fri, 28 Dec 2018 19:12:48 +0100, 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 d313cef8450897c3abf201940f73f57b5dfe8b37
> # Parent  e7865a9776d5f676b2c49390e533bca293be6f9e
> # EXP-Topic sparse-revlog
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d313cef84508
> 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

Can you update the commit message to describe that the original implementation
was wrong if generaldelta is off?


More information about the Mercurial-devel mailing list