r264811 - in /trunk/libstdc++-v3: ChangeLog src...

redi@gcc.gnu.org redi@gcc.gnu.org
Wed Oct 3 11:27:00 GMT 2018

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
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.


More information about the Libstdc++-cvs mailing list