D656: revset: remove "small" argument from "_optimize"

Yuya Nishihara yuya at tcha.org
Sat Sep 9 09:24:00 EDT 2017


On Fri, 8 Sep 2017 17:06:12 +0000, quark (Jun Wu) wrote:
> > yuja wrote in revsetlang.py:421
> > Any reason to choose 1 here and 0.5 for the others?
> 
> I think there are 2 factors deciding weight:
> 
> 1. Time complexity of the revset implementation
> 2. The returned revset size (maybe more important for `and` optimization)
> 
> Here, `:` returns a larger revset so its weight is larger.

I don't think keeping (2) makes much sense because this patch effectively
removes the concept about the computed size. And it's far from being accurate
anyway. In theory, the computed size would be an input to the weight function
of the subsequent query, e.g.

  W_contains(subset) = K_contains * estimated_size(subset)

That said, I don't have strong preference about this. So can you update the
commit message to include why 0.5 or 1.


More information about the Mercurial-devel mailing list