https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77582
--- Comment #3 from Cong Wang ---
Hi, Andrew
I just posted it:
https://gcc.gnu.org/ml/libstdc++/2016-09/msg00051.html
Please review.
I caught this when using Google protobuf on Fedora 21, _M_mutate() is shown in
perf top profile, inlined into
++
Assignee: unassigned at gcc dot gnu.org
Reporter: xiyou.wangcong at gmail dot com
Target Milestone: ---
In !_GLIBCXX_USE_CXX11_ABI implementation, string::clear() calls _M_mutate(),
which could allocate memory as we do COW. This hurts performance when
string::clear() is on the
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77582
--- Comment #1 from Cong Wang ---
Created attachment 39614
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39614&action=edit
A possible patch
This patch improves it by using _S_empty_rep directly when
_GLIBCXX_FULLY_DYNAMIC_STRING is not en