Remove algo logic duplication Round 3
François Dumont
frs.dumont@gmail.com
Mon Sep 30 19:33:00 GMT 2013
On 09/29/2013 07:50 PM, Marc Glisse wrote:
> On Sun, 29 Sep 2013, Paolo Carlini wrote:
>
>>> Maybe we could use more references? The user-facing functions have
>>> to take iterators by value, but I think the inline helpers could use
>>> references.
>>
>> Marc it would be great if you could prepare a patch or provide
>> (offline too, if you like) detailed guidance to Francois. We really
>> want this change to be safe and nop (or very close to that) from the
>> performance point of view. That's why I remained unconvinced and
>> hesitant for such a long time. If we are not sure, let's just admit
>> it, give the issue more thought and reconsider a more satisfactory
>> patch for the next release series.
>
> Busy now, but please don't revert the patch because of my post. The
> number of copies in the previous code was already rather large,
> showing that we didn't care about it. The new code increases it a bit,
> but only by a constant factor. We can improve that incrementally, I
> believe.
>
Considering iterator or functor types as trivial types to copy was
one of the most important hypothesis for this patch to be valid. But I
think it is quite safe, we do our best to have light iterator types in
libstdc++ and any C++ user should know that such types needs to be light
as even the Standard are taking those by copy.
Regarding number of comparisons in sort algo I don't think that it
is a regression of this patch right ? I only remove duplication of code,
didn't change number of invocation of functors.
François
More information about the Libstdc++
mailing list