[Patch] libstdc++/23425
Howard Hinnant
hhinnant@apple.com
Thu Nov 24 16:52:00 GMT 2005
On Nov 24, 2005, at 8:19 AM, Paolo Carlini wrote:
> Paolo Carlini wrote:
>
>>> Yes, _M_erase_at_end would be useful under assign, pop_back, erase,
>>> and resize. A good _M_erase_at_end will do more than simply run the
>>> iterator through. It will do the "segmented iterator" optimization
>>> as promoted by Dietmar for so many years. That is, it will consist
>>> of nested loops where the inner loop runs through a node (or partial
>>> node) at a time with pointers.
>>>
>>>
>> FYI, I'm working on this. It looks like, we are already using the
>> optimization for deque::clear() and we are not for
>> deque::erase(iterator, iterator). It seems to me that we should just
>> take out the code in clear() which implements the double loop pattern
>> and call it from both. Which in fact would be _M_erase_at_end or
>> _M_erase_at_begin ;) ...
>>
>>
> ... and of course, going to loops over plain pointers, instead of
> deque::iterators means that _Destroy will be optimized very, very well
> by the compiler, similarly to what happens for vector! (especially
> so if
> we overload it for random access iterators)
>
> :-)
Thanks Paolo!
-Howard
More information about the Libstdc++
mailing list