[Bug libstdc++/77582] Improve std::string::clear performace
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 enabled.
[Bug libstdc++/77582] New: Improve std::string::clear performace
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77582 Bug ID: 77582 Summary: Improve std::string::clear performace Product: gcc Version: 6.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ 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 hot path.
[Bug libstdc++/77582] Improve std::string::clear performace
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 clear(). AFAIK, only !_GLIBCXX_USE_CXX11_ABI impl uses _M_mutate(). Thanks.