[darcs-devel] [patch1792] inline function Darcs.Patch.Named.namepatch (and 9 more)

Ben Franksen bugs at darcs.net
Tue Jun 11 19:08:35 UTC 2019


Ben Franksen <ben.franksen at online.de> added the comment:

>>>   * add class IdEq2 to Darcs.Patch.Ident
>>>   
>>>   This allows a faster equality test for FLs of patches with identity.
>>
>> I'm a little skeptical of this one. The existing instances of Ident
>> (ignoring any forthcoming changes from you) already have fast equality
>> via their identities.
>>
>> Also, the existing Eq2 for FLs actually commutes them, which for FL
>> (Named p) means that two lists would compare equal if one can be
>> reordered to the other [hopefully laziness would mean that the patch
>> bodies don't actually get commuted, though I wouldn't be sure of that.]
>>
>> So I think for now your operators are equivalent to eqFL/eqFLRev.
> 
> eqFL/eqFLRev sound unfamiliar to me. I may well have re-implemented some
> code that already exists. Let us check that as soon as my V3/camp code
> is in screened. I am always for simplifying things.

Sorry, I was confused and answered without looking at the changes in detail.

Yes, Named patches already have fast equality. And I do think laziness
indeed helps a bit here, since in some, perhaps many cases commute fails
early in the process. But the new operators compare sets of PatchIds
without having to do /any/ commutation. That should, in general, be a
lot faster than what the existing Eq2 instance for FL does.

A possible source of confusion here may be that the patch in question
does not yet define any instances except the generic one for FLs. This
is in another patch (declare instances of IdEq2 for Named, NamedPrim,
and PatchInfoAnd) but that one depends on the V3 additions and thus I
did not add it to this bundle. At least for V3 patches this optimization
is absolutely essential for efficiency (via the NamedPrim instance) and
it may be helpful in other situations, too.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1792>
__________________________________


More information about the darcs-devel mailing list