C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Forbid optimisations on std::basic_string implementations.

From: Bo Persson <bo_at_[hidden]>
Date: Mon, 18 Aug 2025 13:56:21 +0200
On 2025-08-18 at 13:18, Andrey Semashev via Std-Proposals wrote:
> On 18 Aug 2025 13:33, Ben Crowhurst via Std-Proposals wrote:
>>
>> There is a history of STL implementations introducing string
>> optimisations, for example, copy-on-write in GCC (<=4), adoption of
>> small string optimisation (SSO) - with varying details across GCC,
>> Clang, and MSVC.
>>
>> Focusing on SSO, using std::string, along with std::string_view and move
>> semantics, introduces a frustrating folly.
>
> Why? What is the problem with SSO?
>

If you get a string_view to a string, and then move the string, the
string_view may, or may not, move along - all because of SSO.

I too prefer the performance of small strings over fixing this.

Received on 2025-08-18 11:56:27