[PATCH 2 of 3 V2] revset: use phasecache.getrevset

Yuya Nishihara yuya at tcha.org
Sat Feb 18 10:15:34 EST 2017


On Sat, 18 Feb 2017 00:56:09 -0800, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1487407171 28800
> #      Sat Feb 18 00:39:31 2017 -0800
> # Node ID 432992303718ec631b81a351795071c34cfe68f6
> # Parent  7e30a7c38d845e9a526a7ac64c648f18ec51687e
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r 432992303718
> revset: use phasecache.getrevset

> For the pure Python implementation, some operations are faster while "not
> draft()" is noticeably slower:
> 
>   revset  | public()      | not public()  | draft()       | not draft()
>   hidden  |  yes  |  no   |   yes |  no   | yes   |  no   | yes   |  no
>   ------------------------------------------------------------------------
>   before  | 18852 | 17183 | 17758 | 15921 | 17505 | 15973 | 41521 | 39822
>   after   | 18924 | 17380 | 17558 | 14545 | 16727 | 13593 | 48356 | 43992
>   delta   |                       |   -9% |   -5% |  -15% |  +16% |  +10%
> 
> That may be the different performance characters of generatorset vs.
> filteredset. The "not draft()" query could be optimized in this case where
> both "public" and "secret" are passed to "getrevsets" so it won't iterate
> the whole repo twice.

Yeah, generatorset is somewhat costly for membership tests. Instead, phasecache
could return a filteredset, but it wouldn't be always faster.

  s = smartset.fullreposet(repo)
  s.filter(condition, condrepr=('<phase %r>', phases), cache=False)

I see no regression in contrib/base-revsets.txt, and the performance difference
is only seen in pure build, so this series seems good. Queued, thanks.


More information about the Mercurial-devel mailing list