Date: Mon, 18 Aug 2025 14:18:23 +0300
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?
> The name std::basic_string implies a basic implementation, and many
> assume it is nothing more than a wrapper around a C-style character
> pointer with bounds checking.
>
> Could we discuss introducing an alternative string implementation
> (std::buffered_string, std::small_string) to the standard that allows
> optimisations without specifying the core details? Hopefully, this will
> add some clarity to the end-user.
Given that all three major compilers support SSO in std::basic_string,
users have come to expect this from an implementation. Therefore, I
don't see what a new name would provide to users.
If you're suggesting to remove SSO from std::basic_string
implementations then that would be an ABI breaking change, and it would
also detriment users' code performance for no reason, and thus is
unlikely to happen. At least, I would be opposed to this.
>
> 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?
> The name std::basic_string implies a basic implementation, and many
> assume it is nothing more than a wrapper around a C-style character
> pointer with bounds checking.
>
> Could we discuss introducing an alternative string implementation
> (std::buffered_string, std::small_string) to the standard that allows
> optimisations without specifying the core details? Hopefully, this will
> add some clarity to the end-user.
Given that all three major compilers support SSO in std::basic_string,
users have come to expect this from an implementation. Therefore, I
don't see what a new name would provide to users.
If you're suggesting to remove SSO from std::basic_string
implementations then that would be an ABI breaking change, and it would
also detriment users' code performance for no reason, and thus is
unlikely to happen. At least, I would be opposed to this.
Received on 2025-08-18 11:18:27