-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Open
Copy link
Labels
StringArea → standard library: The `String` typeArea → standard library: The `String` typefeatureA feature request or implementationA feature request or implementation
Description
Motivation
In #82442, in support of the String.utf8span
property, we shortened the small string representation to a capacity of 8 bytes for 32-bit platforms without ABI stability. It may be possible to re-arrange structure _StringObject
and enum _StringObject.Variant
to provide a contiguous capacity of 10 bytes for those 32-bit platforms. We should carefully evaluate performance before and after in order to decide whether it should be done.
Proposed solution
My idea is to change _StringObject
and Variant
as follows:
internal enum Variant {
case immortal(UInt)
case native(AnyObject, UInt16)
}
where the UInt16
part of the associated value of .native
stores the value currently stored in the _flags
stored property of _StringObject
.
Alternatives considered
This is not a necessity, but it could restore inline String
instances to the same capacity as before.
Additional information
No response
Metadata
Metadata
Assignees
Labels
StringArea → standard library: The `String` typeArea → standard library: The `String` typefeatureA feature request or implementationA feature request or implementation