Skip to content
Unverified Commit 1a5af34e authored by Louis Dionne's avatar Louis Dionne Committed by GitHub
Browse files

[libc++] Speed up classic locale (take 2) (#73533)



Locale objects use atomic reference counting, which may be very
expensive in parallel applications. The classic locale is used by
default by all streams and can be very contended. But it's never
destroyed, so the reference counting is also completely pointless on the
classic locale. Currently ~70% of time in the parallel stringstream
benchmarks is spent in locale ctor/dtor. And the execution radically
slows down with more threads.

Avoid reference counting on the classic locale. With this change
parallel benchmarks start to scale with threads.

This is a re-application of f8afc53d (aka PR #72112) which was
reverted in 4e0c48b9 because it broke the sanitizer builds due
to an initialization order fiasco. This issue has now been fixed by
ensuring that the locale is constinit'ed.

Co-authored-by: default avatarDmitry Vyukov <dvyukov@google.com>
parent fa712b07
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment