[PATCH 4 of 4] revset: do not nest addset by "addset + other" (issue4565)

Yuya Nishihara yuya at tcha.org
Thu May 21 07:28:15 CDT 2015

On Wed, 20 May 2015 23:26:35 -0500, Pierre-Yves David wrote:
> On 05/19/2015 07:18 AM, Yuya Nishihara wrote:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya at tcha.org>
> > # Date 1426409247 -32400
> > #      Sun Mar 15 17:47:27 2015 +0900
> > # Node ID 72e8a0b846616a92781beda44eab8d6c39c91933
> > # Parent  9996864f9e14a826ebe20df3a48905a662fe8eba
> > revset: do not nest addset by "addset + other" (issue4565)
> There is good idea in this series and some interesting win.
> However, this is adding significant more complexity and special casing 
> to the code. I'm feeling very uncomfortable about that since the 
> smartset class are already "not simple". I feel like we'll need to start
> converting the code object to C class soon and every special case here
> (eg: new class).

Perhaps we can merge unionset and addset in C implementation. It just exists
to avoid the use of "any()".

> There is also some more generic optimisation that could
> be worthwhile. We should meet on IRC/video call to discuss the situation
> in details
> Here is the nice thing I see in your series:
> - The logarithmic combination used for the sorting,
> - The creation of a wider object when something is added to a addset 
> (wider instead of deeper)
> There is couple of generic stuff that are worth looking at too:
> - The optimizer could directly build a balanced tree for addition
> instead of making it pure depth.

Yes for "a + b + c", but probably no for "-r a -r b -r c".

> - We could directly performs add operation for smartset that are already
> all known (baseset + baseset, the case that actually interest use for
> both currently open issue)

Isn't it too optimistic?

FWIW, I have 10 more patches that will do

 - fix stack overflow on alias expansion and optimize() (issue4624)
 - build unionset([A, B, C]) directly from "a() + b() + c()"
   (perhaps, this can be balanced addsets)
 - build baseset([a, b, c]) directly from "a + b + c"

> Also
> - We should also determine if it is safe to alter smartset in place.
> This could simplify multiple things.
> When and how could we discuss this?

My IRC time is around 12:00-14:00 UTC (21:00-23:00 JST) on weekdays,
or weekend?


More information about the Mercurial-devel mailing list