Skip to content

[4.2] Some string performance changes #16542

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 4 commits into from
May 12, 2018

Conversation

eeckstein
Copy link
Contributor

See commit messages for details

eeckstein added 3 commits May 11, 2018 09:21
Beside the general goal to remove inlinable functions, this reduces code size and also improves performance for several benchmarks.
The performance problem was that by inlining top-level String API functions into client code (like String.count) it ended up calling non-inlinable internal String functions eventually.
This is much slower than to make a single call at the top-level API boundary into the library. Inside the library all the internal String functions can be specialized and inlined.

rdar://problem/39921548
Re-wrote the inner memcpy loops so that they can be vectorized.
Also added a few inline(__always).

Since we removed some @inlineable attributes this string-append code is not code generated in the client anymore.
The code generation in the stdlib binary is different because all the precondition checks are not folded away.
Using explicit loop control statements instead of for-in-range removes the precondition-overhead for those time critical memcpy loops.
@eeckstein
Copy link
Contributor Author

@swift-ci test and merge

@eeckstein
Copy link
Contributor Author

@swift-ci test and merge

1 similar comment
@eeckstein
Copy link
Contributor Author

@swift-ci test and merge

@eeckstein
Copy link
Contributor Author

@swift-ci test OS X

1 similar comment
@eeckstein
Copy link
Contributor Author

@swift-ci test OS X

@airspeedswift airspeedswift merged commit 9f28451 into swiftlang:swift-4.2-branch May 12, 2018
@eeckstein eeckstein deleted the string-perf-4.2 branch May 14, 2018 15:51
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