This is to track this issue: http://gcc.gnu.org/ml/libstdc++/2005-11/msg00031.html A first part, about _M_erase_at_end/_M_erase_at_begin, should be doable relatively quickly.
Confirmed.
More interesting work to do: http://gcc.gnu.org/ml/libstdc++/2005-11/msg00241.html
This part is done: http://gcc.gnu.org/ml/libstdc++/2005-11/msg00240.html can also go in mainline.
Created attachment 33542 [details] Patch to cache a free node. (In reply to Paolo Carlini from comment #2) > More interesting work to do: > > http://gcc.gnu.org/ml/libstdc++/2005-11/msg00241.html Here's a proof of concept to prevent repeated reallocations for this case: while (a long time) { dq.push_front(t); ... dq.pop_back(); } A single free node is cached in _M_map[-1], so there's no change to the layout of the class.
See also PR 77524
Prototype patch: https://gcc.gnu.org/ml/libstdc++/2016-10/msg00017.html