Skip to content

String::as_mut_vec prevents small string optimization #20198

Closed
@petrochenkov

Description

@petrochenkov

SSO is a popular optimization technique and is currently implemented in all the major C++ standard libraries*.
If Rust decides to adopt it too then it will come into contradiction with the String::as_mut_vec method, which exposes details of the current String implementation incompatible with SSO.
I suppose, the choice between these two has to be made before marking as_mut_vec as stable.

*Although it's not used by default in libstdc++ due to ABI compatibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions