[libcxx-commits] [libcxx] [libc++] Speed up classic locale (PR #70631)
Dmitry Vyukov via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 13 00:52:12 PST 2023
dvyukov wrote:
> As Nikolas mentioned, this is an ABI break. The speedup is interesting, but we'd need to either find a way to make this not an ABI break, or to only enable the optimization under an ABI flag.
>
> Is there any reason why we're not storing the classic locale pointer you're adding to the `locale` class inside the `__imp` class instead? I think that would allow not breaking the ABI, since that's a pimpl idiom.
I don't understand the problem space well, so I am open to suggestions re ABI.
What exactly is breaking ABI here? New methods? Inline methods? The static field?
What is ABI flag? How bad is this?
What are other options? Were there similar precendents?
Re __imp/pimpl, the original motivation was inlining. __imp is not in the header, so we can get access to it from any inline methods.
If there are no good options that preserve inlining, I guess we can give up on it. It contributes to this speed somewhat:
```
Ostream_number/0/real_time/threads:1 184.0n ± 1% 135.0n ± 1% -26.63% (p=0.000 n=24)
```
But for this, more important one, it's probably in the noise:
```
Ostream_number/0/real_time/threads:72 17279.0n ± 4% 308.0n ± 1% -98.22% (p=0.000 n=24)
```
https://github.com/llvm/llvm-project/pull/70631
More information about the libcxx-commits
mailing list