[PATCH 3 of 3 STABLE] revset: more optimally handle __sub__ (issue4352)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Sep 8 11:43:17 CDT 2014

On 09/08/2014 06:27 PM, Gregory Szorc wrote:
> On 9/8/14 4:59 AM, Pierre-Yves David wrote:
>> On 09/08/2014 03:44 AM, Gregory Szorc wrote:

>> It has quite bad impact (+10%) on multiple revset. Some of them does not
>> seems to involved substraction at all. Did you dig a bit the source of
>> these regression?
> revset.orset() performs a subtraction. In the case of the author()
> benchmarks, subset is a spanset covering the entire repository.
> I /think/ the regression stems from the isinstance(x, baseset) handling
> in spanset.__sub__. Where we once were performing simple set math, now
> we perform something slightly more complicated.

Can I get you to move from "I think" to "I check profile and it appears 

If the isinstance is actually slowing things down, we should probably 
replace it by wome appropriate attribute lookup (duck typing my love)

> Making _diffset._iterator work lazily in all cases should reclaim the
> performance loss. Or, we could add back in the special case handling for
> lazy-vs-non-lazy instances. This code is getting pretty complicated...

yup :-/

Pierre-Yves David

More information about the Mercurial-devel mailing list