Deque::fill (was: Re: Deque...)

Paolo Carlini pcarlini@suse.de
Mon Dec 12 14:30:00 GMT 2005


Hi Howard,

> *  We call std::copy a lot internally (with deque::iterators as the 
> output range, or both input and output).  We need to specialize 
> (overload) std::copy to work nicely with deque::iterator (the 
> segmented iterator optimization).    Same goes for the other 
> std::algorithms we call.

as you know already I'm working also on this nice suggestion of yours.

A low hanging fruit seems fill, which actually is used quite a bit, and
the below is what I currently have, how does it look? Of course, copy is
going to be more important, but is also much more tricky... ;)

Performance-wise, on simple stuff like

  deque<int> d(10000, 1);
  for (int j = 0; j < 100; ++j)
    for (deque<int>::size_type i = 0; i < 10000; ++i)
      d.assign(i, 3);

timings go down from ~7.3 secs -> ~5.4 secs on P4-2400. We improve much
more if the underlying fill on plain pointers uses memset (e.g, chars),
down to ~2.2 secs.

Paolo.

/////////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_deque_fill
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20051212/ba25ea85/attachment.ksh>


More information about the Libstdc++ mailing list