-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[5.0] Assorted String bridging improvements #20899
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
[5.0] Assorted String bridging improvements #20899
Conversation
@swift-ci please test |
Build failed |
So #20900 supersedes this, right? |
That cherry-picks this, which would otherwise conflict after either is merged. I don't care how you prefer to manage it, if you merge this than a rebase would drop it from the other PR. The test failure looks legit:
@Catfish-Man, is there more to cherry-pick here? Can you diff the file vs master and make sure we get everything? |
Dangit, I thought I included the fix for that. Will deal with that shortly. |
dc6a850
to
98514e1
Compare
@swift-ci please test |
Build failed |
Build failed |
• Convert _AbstractStringStorage to a protocol, and the free functions used to deduplicate implementations to extensions on that protocol. • Move 'start' into the abstract type and use that to simplify some code • Move the ASCII fast path for length into UTF16View. • Add a weirder but faster way to check which (if any) of our NSString subclasses a given object is, and adopt it (cherry picked from commit 8b57921)
98514e1
to
c3eb78c
Compare
@swift-ci please test |
Build failed |
Build failed |
Closing as superseded by #20900 |
Explanation:
• Convert _AbstractStringStorage to a protocol, and the free functions used to deduplicate implementations to extensions on that protocol.
• Move 'start' into the abstract type and use that to simplify some code
• Move the ASCII fast path for length into UTF16View.
• Add a weirder but faster way to check which (if any) of our NSString subclasses a given object is, and adopt it
Scope: This changes most operations on Swift Strings which are bridged into ObjC, but in relatively minor ways. This is a performance improvement, but is primarily important for Swift 5.0 because it will cause merge conflicts repeatedly if we don't have it.
Risk: Low-Medium. The main risk would be if someone is somehow relying on KVO subclassing of bridged Swift Strings, but since KVO doesn't actually work on NSStrings,
Testing: Passed regression tests, and the perf test suite exercises these operations over the bridge as well.
Reviewed by: @milseman