Skip to content

Keep the buffer in the invalid UTF8 handling path of String(unsafeUninitializedCapacity:initializingWith:) alive while we're using it #39105

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 6 commits into from
Aug 31, 2021

Conversation

Catfish-Man
Copy link
Contributor

No description provided.

…ing path of String(unsafeUninitializedCapacity:initializingWith:) before calling a function which might invalidate the String's buffer. rdar://80379070
@Catfish-Man Catfish-Man requested a review from milseman August 31, 2021 04:28
@Catfish-Man Catfish-Man self-assigned this Aug 31, 2021
@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@Catfish-Man
Copy link
Contributor Author

@swift-ci please smoke benchmark

@swift-ci
Copy link
Contributor

Performance (x86_64): -O

Regression OLD NEW DELTA RATIO
DictionaryOfAnyHashableStrings_insert 2940 5628 +91.4% 0.52x
DictionaryKeysContainsNative 21 26 +23.8% 0.81x (?)
SortStringsUnicode 2885 3110 +7.8% 0.93x (?)
EqualStringSubstring 39 42 +7.7% 0.93x
EqualSubstringString 39 42 +7.7% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
StringFromLongWholeSubstring 5 4 -20.0% 1.25x

Code size: -O

Performance (x86_64): -Osize

Regression OLD NEW DELTA RATIO
EqualSubstringSubstringGenericEquatable 39 43 +10.3% 0.91x (?)
LessSubstringSubstring 39 42 +7.7% 0.93x (?)
EqualSubstringSubstring 39 42 +7.7% 0.93x (?)
EqualStringSubstring 39 42 +7.7% 0.93x (?)
EqualSubstringString 39 42 +7.7% 0.93x (?)
LessSubstringSubstringGenericComparable 39 42 +7.7% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
StringFromLongWholeSubstring 5 4 -20.0% 1.25x
String.data.LargeUnicode 109 95 -12.8% 1.15x (?)
StringToDataLargeUnicode 3500 3200 -8.6% 1.09x (?)
ObjectiveCBridgeStubFromNSDate 6990 6450 -7.7% 1.08x (?)

Code size: -Osize

Performance (x86_64): -Onone

Code size: -swiftlibs

How to read the data The tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.

If you see any unexpected regressions, you should consider fixing the
regressions before you merge the PR.

Noise: Sometimes the performance results (not code size!) contain false
alarms. Unexpected regressions which are marked with '(?)' are probably noise.
If you see regressions which you cannot explain you can try to run the
benchmarks again. If regressions still show up, please consult with the
performance team (@eeckstein).

Hardware Overview
  Model Name: Mac Pro
  Model Identifier: MacPro6,1
  Processor Name: 12-Core Intel Xeon E5
  Processor Speed: 2.7 GHz
  Number of Processors: 1
  Total Number of Cores: 12
  L2 Cache (per Core): 256 KB
  L3 Cache: 30 MB
  Memory: 16 GB

@Catfish-Man
Copy link
Contributor Author

Looks like all noise for perf, but someone should figure out what's up with DictionaryOfAnyHashableStrings_insert, it's being weird lately

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 4bdc8e3


Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: trailing whitespace.

@Catfish-Man
Copy link
Contributor Author

@swift-ci please smoke test

…F8 handling path of String(unsafeUninitializedCapacity:initializingWith:) before calling a function which might invalidate the String's buffer. rdar://80379070"

This reverts commit 4bdc8e3.
@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@Catfish-Man
Copy link
Contributor Author

UGH I reverted the test changes accidentally. Ok, I'm going to eat breakfast first so I can think properly, THEN fix this PR.

@Catfish-Man
Copy link
Contributor Author

@swift-ci please smoke test

@Catfish-Man Catfish-Man changed the title Copy the code units into a temporary buffer in the invalid UTF8 handling path of String(unsafeUninitializedCapacity:initializingWith:) before calling a function which might invalidate the String's buffer Keep the buffer in the invalid UTF8 handling path of String(unsafeUninitializedCapacity:initializingWith:) alive while we're using it Aug 31, 2021
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

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.

5 participants