Skip to content

Conversation

@eeckstein
Copy link
Contributor

For details see commits.

rdar://problem/39978743

eeckstein added 3 commits May 18, 2018 19:10
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

@eeckstein eeckstein changed the title Fixes for String performance regressions [4.2 04-30] Fixes for String performance regressions May 19, 2018
@eeckstein
Copy link
Contributor Author

Explanation: These changes fix some major regressions, which were introduced with the new String implementation
Scope: It affects much real-world code which deals with Strings.
Radar/SR Issue: rdar://problem/39978743
Risk: Low: the changes are simple and already tested since a while on master.
Testing: Tested with all the String tests in test suite.
Reviewer: @milseman

Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 4992ce7

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 4992ce7

@eeckstein
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 4992ce7

@milseman
Copy link
Member

@swift-ci please test linux platform

@najacque najacque merged commit 97985ba into swiftlang:swift-4.2-branch-04-30-2018 May 19, 2018
@eeckstein eeckstein deleted the string-changes-4-30 branch April 17, 2021 15:04
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.

4 participants