-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[4.2] Small Strings cherry-picked into 4.2 #15553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Streamline internal String creation. Previously, everything funneled into a single generic function, however, every single call of the generic funnel had relevant specific information that could be used for a more efficient algorithm. In preparation for efficiently forming small strings, refactor this logic into a handful of more specialized subroutines to preserve more specific information from the callers.
This adds a small string representation capable of holding up to 15 ASCII code units directly in registers. This is extendable to UTF-8 in the future. It is intended to be the preferred representation whenever possible for String, and is intended to be a String fast-path. Future small forms may be added in the future (likely off the fast-path). Small strings are available on 64-bit, where they are most beneficial and well accomodated by limited address spaces. They are unavailable on 32-bit, where they are less of a win and would require much more hackery due to full address spaces.
Switch StringObject and StringGuts from opaquely storing tagged cocoa strings into storing small strings. Plumb small string support throughout the standard library's routines.
Whenever possible, prefer the small string format. Updates creation logic. Adds assertion on large strings that they're not intended to be small.
Please test with the following PR: apple/swift-lldb#471 @swift-ci please test |
Please test with the following PR: apple/swift-lldb#471 @swift-ci please test |
Build failed |
Build failed |
Please test with the following PR: apple/swift-lldb#471 @swift-ci please test |
@lorentey this is a cherry-pick of master |
Build failed |
Please test with the following PR: apple/swift-lldb#471 @swift-ci please test Linux Platform |
Build failed |
Please test with the following PR: @swift-ci please test Linux Platform |
Build failed |
Please test with the following PR: @swift-ci please test Linux Platform |
This is a cherry-pick of #14755