Skip to content

Avoid an unnecessary call to CFStringGetCharactersPtr in bridging #38970

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 1 commit into from
Aug 20, 2021

Conversation

Catfish-Man
Copy link
Contributor

No description provided.

@Catfish-Man Catfish-Man self-assigned this Aug 20, 2021
@Catfish-Man
Copy link
Contributor Author

@swift-ci please smoke test

@Catfish-Man
Copy link
Contributor Author

@swift-ci please benchmark

@Catfish-Man
Copy link
Contributor Author

@swift-ci Apple Silicon benchmark

@swift-ci
Copy link
Contributor

Performance (x86_64): -O

Regression OLD NEW DELTA RATIO
ArrayAppendOptionals 1330 2460 +85.0% 0.54x (?)
DictionaryOfAnyHashableStrings_insert 3010 5558 +84.7% 0.54x
ObjectiveCBridgeStubFromNSDate 6300 7140 +13.3% 0.88x (?)
DictionaryKeysContainsNative 23 26 +13.0% 0.88x (?)

Code size: -O

Performance (x86_64): -Osize

Regression OLD NEW DELTA RATIO
FlattenListFlatMap 6119 6815 +11.4% 0.90x (?)
 
Improvement OLD NEW DELTA RATIO
ObjectiveCBridgeStubFromNSDate 7360 6270 -14.8% 1.17x (?)

Code size: -Osize

Performance (x86_64): -Onone

Regression OLD NEW DELTA RATIO
NSError 617 690 +11.8% 0.89x (?)
String.data.Medium 164 182 +11.0% 0.90x (?)
String.data.LargeUnicode 167 180 +7.8% 0.93x (?)
String.data.Small 79 85 +7.6% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
ObjectiveCBridgeFromNSStringForced 3030 2800 -7.6% 1.08x (?)

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: 64 GB

@Catfish-Man
Copy link
Contributor Author

Looks like the win is smaller than the 7% threshold the benchmark will report. Not entirely surprising. Still worth doing I think.

@Catfish-Man Catfish-Man merged commit 5f268cc into swiftlang:main Aug 20, 2021
@swift-ci
Copy link
Contributor

Performance (arm64): -O

Regression OLD NEW DELTA RATIO
DictionaryOfAnyHashableStrings_insert 1260 2282 +81.1% 0.55x (?)
Set.isDisjoint.Int25 86 130 +51.2% 0.66x (?)
StringRemoveDupes 117 142 +21.4% 0.82x (?)
DictionaryGroupOfObjects 441 531 +20.4% 0.83x (?)
SubstringFromLongStringGeneric 5 6 +20.0% 0.83x (?)
Set.isStrictSubset.Box25 83 94 +13.3% 0.88x (?)
SetIsSubsetBox25 83 94 +13.3% 0.88x (?)
DictionaryRemove 1730 1930 +11.6% 0.90x (?)
DictionaryGroup 114 127 +11.4% 0.90x (?)
NSArray.bridged.objectAtIndex 194 216 +11.3% 0.90x (?)
StringHasPrefixAscii 1210 1340 +10.7% 0.90x (?)
StringHasSuffixAscii 1310 1430 +9.2% 0.92x (?)
SetIsSubsetInt50 83 90 +8.4% 0.92x (?)
LazilyFilteredArrays2 1300 1400 +7.7% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
LessSubstringSubstring 21 18 -14.3% 1.17x (?)
EqualSubstringSubstring 21 18 -14.3% 1.17x (?)
EqualStringSubstring 21 18 -14.3% 1.17x (?)
EqualSubstringSubstringGenericEquatable 21 18 -14.3% 1.17x (?)
EqualSubstringString 21 18 -14.3% 1.17x (?)
LessSubstringSubstringGenericComparable 21 18 -14.3% 1.17x (?)
ArrayAppendToGeneric 190 170 -10.5% 1.12x (?)
ArrayAppendToFromGeneric 190 170 -10.5% 1.12x (?)
Set.filter.Int100.24k 853 778 -8.8% 1.10x (?)
Dict.CopyKeyValue.24k 867 796 -8.2% 1.09x (?)
Set.filter.Int100.20k 729 671 -8.0% 1.09x (?)
Dict.CopyKeyValue.20k 742 691 -6.9% 1.07x (?)

Code size: -O

Improvement OLD NEW DELTA RATIO
BufferFill.o 7314 7118 -2.7% 1.03x

Performance (arm64): -Osize

Improvement OLD NEW DELTA RATIO
RawBufferCopyBytes 249 12 -95.2% 20.75x
EqualStringSubstring 21 18 -14.3% 1.17x (?)
EqualSubstringString 21 18 -14.3% 1.17x (?)
LessSubstringSubstring 22 19 -13.6% 1.16x (?)
EqualSubstringSubstring 22 19 -13.6% 1.16x (?)
EqualSubstringSubstringGenericEquatable 22 19 -13.6% 1.16x (?)
LessSubstringSubstringGenericComparable 22 19 -13.6% 1.16x (?)
NSArray.bridged.objectAtIndex 219 196 -10.5% 1.12x (?)

Code size: -Osize

Performance (arm64): -Onone

Regression OLD NEW DELTA RATIO
ArrayAppendToFromGeneric 160 180 +12.5% 0.89x (?)
 
Improvement OLD NEW DELTA RATIO
RawBufferCopyBytes 74031 13 -100.0% 5694.25x
ArrayAppendGenericStructs 940 430 -54.3% 2.19x (?)
LessSubstringSubstring 39 35 -10.3% 1.11x (?)
EqualSubstringSubstring 39 35 -10.3% 1.11x (?)
EqualSubstringSubstringGenericEquatable 39 35 -10.3% 1.11x (?)
LessSubstringSubstringGenericComparable 39 35 -10.3% 1.11x (?)
COWArrayGuaranteedParameterOverhead 2650 2400 -9.4% 1.10x (?)
EqualStringSubstring 39 36 -7.7% 1.08x (?)
EqualSubstringString 39 36 -7.7% 1.08x (?)

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 mini
  Model Identifier: Macmini9,1
  Total Number of Cores: 8 (4 performance and 4 efficiency)
  Memory: 16 GB

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.

2 participants