https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59439

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Wed Oct  3 11:27:40 2018
New Revision: 264811

URL: https://gcc.gnu.org/viewcvs?rev=264811&root=gcc&view=rev
Log:
PR libstdc++/59439 optimize uses of classic ("C") std::locale

The global locale::_Impl that represents the "C" locale is never
destroyed, so there is no need to keep track of reference count updates
for that object. This greatly reduce contention between threads that
refer to the classic locale. Since the global std::locale initially uses
the classic locale, this benefits the common case for any code using the
global locale, such as construction/destruction of iostream objects.

All these updates are done inside libstdc++.so so there's no need to
worry about users' objects having inlined old versions of the code which
still update the reference count for the classic locale.

        PR libstdc++/59439
        * src/c++98/locale.cc (locale::locale(const locale&)): Bypass
        reference count updates for the classic locale.
        (locale::~locale()): Likewise.
        (locale::operator=(const locale&)): Likewise.
        * src/c++98/locale_init.cc (locale::locale()): Likewise.
        (locale::global(const locale&)): Likewise.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/src/c++98/locale.cc
    trunk/libstdc++-v3/src/c++98/locale_init.cc

Reply via email to