Skip to content

[5.0] String performance and code size improvements #21081

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

Merged
merged 2 commits into from
Dec 8, 2018

Conversation

milseman
Copy link
Member

@milseman milseman commented Dec 6, 2018

This is a cherry-pick PR of #21024 and #21072, which bring performance and code size improvements.

Compare small strings in-register when they store ASCII (and thus NFC)
contents.
Add in a fast-path for Strings created from Substring which covers the
entire String. Put String-from-Substring behind a non-inlinable
resilience barrier for future flexibility.
@milseman milseman requested a review from a team as a code owner December 6, 2018 17:07
@milseman
Copy link
Member Author

milseman commented Dec 6, 2018

@apple/swift5-branch-managers we will want this for the release, but no rush.

  • Comparison of small ASCII strings skips spilling to the stack (~3x faster)
  • Creating a String from a Substring which covers its entire contents is just a retain (~7x faster)
  • Smaller code size of Substring-intensive code (~5% improvement).

Convergence

This adds nice performance and code size improvements, but is not necessary for convergence.

ABI impact

None/Additive

@milseman
Copy link
Member Author

milseman commented Dec 6, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Dec 6, 2018

Build failed
Swift Test OS X Platform
Git Sha - ab26c96

@airspeedswift
Copy link
Member

@swift-ci please test macOS platform

@airspeedswift airspeedswift merged commit 3945260 into swiftlang:swift-5.0-branch Dec 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants