[Bug libstdc++/59439] std::locale uses atomic instructions on construction

antoshkka at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Apr 20 08:33:00 GMT 2014


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

Antony Polukhin <antoshkka at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |antoshkka at gmail dot com

--- Comment #7 from Antony Polukhin <antoshkka at gmail dot com> ---
(In reply to Jonathan Wakely from comment #5)
> There's a good reason boost::lexical_cast is special-cased for the common
> int-to-string conversions that don't need fancy formatting.

I'm the current maintainer of boost::lexical_cast and I'd like to add my 2
cetns.

Construction of std::locale is a common case all around the Boost libraries.
Here are some of the cases when std::locale is constructed:
* in almost any conversion with boost::lexical_cast
* in all the string related algorithms in Boost.Algorithm (like compare(),
erase(), find() and others)
* in methods of Boost.Locale like to_upper, to_lower, normalize and others...
* in parsers of Boost.PropertyTree

In most cases I've seen only the global 'C' locale is used in user code, so
optimizing it's construction/descruction/copying will have a good impact on
code performance.



More information about the Gcc-bugs mailing list