[PATCH 2 of 3] revset: use phasecache.getrevs

Jun Wu quark at fb.com
Thu Feb 16 16:31:26 EST 2017


Excerpts from Yuya Nishihara's message of 2017-02-13 23:56:20 +0900:
> On Fri, 10 Feb 2017 06:34:18 -0800, Jun Wu wrote:
> > # HG changeset patch
> > # User Jun Wu <quark at fb.com>
> > # Date 1486735766 28800
> > #      Fri Feb 10 06:09:26 2017 -0800
> > # Node ID 44f2c707475a79758ecbc4b4117b9cda9d7a4380
> > # Parent  1d7a184bb013a1a6f6b92d1f6d89406a7254ba2b
> > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > #              hg pull https://bitbucket.org/quark-zju/hg-draft  -r 44f2c707475a
> > revset: use phasecache.getrevs
> 
> > The change may make "not public()" slower in the pure version where there
> > are many non-public changesets, because of an unnecessary sort. But
> > performance should be unchanged for the default CPython version. Since
> > non-public changesets are not expected to be many, and most users use the
> > CPython version, the code clean-up seems worthy.
> 
> Perhaps you can make getrevs() return a lazy smartset object so the pure
> version should have the same performance characteristic as before. I mean
> getrevs(repo, target) could be identical to _phase(repo, subset, target) and
> _notpublic(repo, subset, x) given subset=fullreposet.

Actually, smartset.baseset will do "data = list(data)" if data is a set.
If we use baseset, the "set" to "list" conversion is an unwanted overhead.

Maybe we can be even smarter: lazily initializing baseset._list.

> 
> The direction of this series looks nice.


More information about the Mercurial-devel mailing list