Skip to content

Conversation

@Catfish-Man
Copy link
Contributor

No description provided.

@Catfish-Man
Copy link
Contributor Author

@swift-ci please smoke benchmark

@Catfish-Man
Copy link
Contributor Author

This will almost certainly be a (hopefully smallish) perf regression. I have a plan for fixing it once other pieces are in place.

@swift-ci
Copy link
Contributor

swift-ci commented Aug 9, 2019

Performance: -O

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeToNSString 362 1605 +343.4% 0.23x
NSStringConversion.Rebridge 206 520 +152.4% 0.40x
ObjectiveCBridgeToNSArray 14300 27500 +92.3% 0.52x
NSStringConversion.Rebridge.Mutable 824 1476 +79.1% 0.56x
ObjectiveCBridgeStubToNSString 2370 4240 +78.9% 0.56x
SevenBoom 819 1452 +77.3% 0.56x
NSError 162 285 +75.9% 0.57x
ObjectiveCBridgeToNSSet 19250 32050 +66.5% 0.60x
ObjectiveCBridgeStubToArrayOfNSString2 4020 6240 +55.2% 0.64x
DictionaryBridgeToObjC_Access 870 1277 +46.8% 0.68x (?)
DictionaryBridge 846 1031 +21.9% 0.82x (?)
ObjectiveCBridgeStubURLAppendPathRef2 2430 2830 +16.5% 0.86x
ObjectiveCBridgeStubURLAppendPath2 2500 2850 +14.0% 0.88x (?)
PlistPerfEncode 511 570 +11.5% 0.90x
UTF8Decode_InitDecoding_ascii 257 286 +11.3% 0.90x (?)
FlattenListLoop 4338 4825 +11.2% 0.90x (?)
IterateData 1327 1453 +9.5% 0.91x (?)
 
Improvement OLD NEW DELTA RATIO
ObjectiveCBridgeStubToNSDate2 1460 1260 -13.7% 1.16x (?)
RandomShuffleLCG2 768 704 -8.3% 1.09x
SuffixAnySequenceLazy 4252 3913 -8.0% 1.09x (?)
Set.isDisjoint.Seq.Box.Empty 127 117 -7.9% 1.09x
Array2D 7520 6928 -7.9% 1.09x (?)
Data.hash.Empty 77 71 -7.8% 1.08x (?)
RemoveWhereSwapInts 67 62 -7.5% 1.08x (?)
MapReduce 397 368 -7.3% 1.08x
MapReduceAnyCollection 398 369 -7.3% 1.08x
StringUTF16SubstringBuilder 3030 2820 -6.9% 1.07x (?)
Set.isSubset.Seq.Int.Empty 217 202 -6.9% 1.07x
NormalizedIterator_fastPrenormal 1060 990 -6.6% 1.07x
Set.isDisjoint.Seq.Int.Empty 91 85 -6.6% 1.07x (?)

Code size: -O

Performance: -Osize

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeToNSString 378 1604 +324.3% 0.24x
NSStringConversion.Rebridge 206 518 +151.5% 0.40x
ObjectiveCBridgeToNSArray 14550 27250 +87.3% 0.53x
NSStringConversion.Rebridge.Mutable 792 1465 +85.0% 0.54x
ObjectiveCBridgeStubToNSString 2380 4230 +77.7% 0.56x
SevenBoom 865 1473 +70.3% 0.59x
ObjectiveCBridgeToNSSet 18900 31200 +65.1% 0.61x
ObjectiveCBridgeStubToArrayOfNSString2 4020 6180 +53.7% 0.65x (?)
NSError 234 354 +51.3% 0.66x
DictionaryBridgeToObjC_Access 903 1267 +40.3% 0.71x (?)
DictionaryBridge 864 1049 +21.4% 0.82x (?)
ObjectiveCBridgeStubURLAppendPathRef2 2530 2910 +15.0% 0.87x (?)
ObjectiveCBridgeStubURLAppendPath2 2610 3000 +14.9% 0.87x (?)
PlistPerfEncode 503 563 +11.9% 0.89x (?)
JSONPerfEncode 577 643 +11.4% 0.90x (?)
IterateData 1326 1451 +9.4% 0.91x (?)
 
Improvement OLD NEW DELTA RATIO
Set.isDisjoint.Int.Empty 168 152 -9.5% 1.11x (?)
FlattenListLoop 4428 4057 -8.4% 1.09x (?)
Set.isSubset.Int.Empty 97 89 -8.2% 1.09x (?)
RemoveWhereMoveInts 37 34 -8.1% 1.09x
Array2D 7520 6928 -7.9% 1.09x (?)
Data.hash.Empty 77 71 -7.8% 1.08x (?)
RemoveWhereSwapInts 65 60 -7.7% 1.08x
Set.isDisjoint.Seq.Box.Empty 170 157 -7.6% 1.08x (?)
NormalizedIterator_fastPrenormal 1070 990 -7.5% 1.08x (?)
Set.isSubset.Seq.Int.Empty 217 202 -6.9% 1.07x (?)
Set.isStrictSubset.Seq.Int.Empty 220 205 -6.8% 1.07x

Code size: -Osize

Performance: -Onone

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeToNSString 451 1699 +276.7% 0.27x
NSStringConversion.Rebridge 232 547 +135.8% 0.42x
ObjectiveCBridgeToNSArray 14900 27500 +84.6% 0.54x
NSStringConversion.Rebridge.Mutable 873 1515 +73.5% 0.58x
ObjectiveCBridgeStubToNSString 2480 4300 +73.4% 0.58x
ObjectiveCBridgeToNSSet 19450 32600 +67.6% 0.60x
SevenBoom 987 1615 +63.6% 0.61x
ObjectiveCBridgeStubToArrayOfNSString2 4060 6060 +49.3% 0.67x (?)
DictionaryBridgeToObjC_Access 1039 1404 +35.1% 0.74x (?)
NSError 596 718 +20.5% 0.83x
DictionaryBridge 977 1116 +14.2% 0.88x (?)
JSONPerfEncode 610 681 +11.6% 0.90x (?)
ObjectiveCBridgeStubURLAppendPathRef2 2680 2980 +11.2% 0.90x (?)
PlistPerfEncode 536 592 +10.4% 0.91x (?)
ObjectiveCBridgeStubURLAppendPath2 2710 2960 +9.2% 0.92x (?)
DictionaryOfAnyHashableStrings_insert 7294 7924 +8.6% 0.92x (?)
 
Improvement OLD NEW DELTA RATIO
StringInterpolation 13700 12300 -10.2% 1.11x (?)
FloatingPointPrinting_Float_interpolated 58600 53400 -8.9% 1.10x (?)
EqualStringSubstring 51 47 -7.8% 1.09x (?)
Data.hash.Empty 154 142 -7.8% 1.08x (?)
ArrayOfGenericPOD2 1432 1321 -7.8% 1.08x (?)
ArrayOfPOD 1140 1062 -6.8% 1.07x (?)

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

Nooooooo :( :(

@Catfish-Man
Copy link
Contributor Author

@swift-ci please smoke benchmark

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeToNSString 362 1595 +340.6% 0.23x
NSStringConversion.Rebridge 206 519 +151.9% 0.40x
ObjectiveCBridgeToNSArray 14450 27500 +90.3% 0.53x
NSStringConversion.Rebridge.Mutable 810 1467 +81.1% 0.55x
NSError 161 286 +77.6% 0.56x
SevenBoom 815 1443 +77.1% 0.56x
ObjectiveCBridgeStubToNSString 2380 4200 +76.5% 0.57x
ObjectiveCBridgeToNSSet 18800 32250 +71.5% 0.58x
ObjectiveCBridgeStubToArrayOfNSString2 4020 6120 +52.2% 0.66x
DictionaryBridgeToObjC_Access 872 1264 +45.0% 0.69x (?)
DictionaryBridge 843 1037 +23.0% 0.81x (?)
ObjectiveCBridgeStubURLAppendPath2 2400 2910 +21.2% 0.82x (?)
ObjectiveCBridgeStubURLAppendPathRef2 2390 2820 +18.0% 0.85x (?)
JSONPerfEncode 582 649 +11.5% 0.90x (?)
PlistPerfEncode 514 568 +10.5% 0.90x (?)
IterateData 1326 1451 +9.4% 0.91x (?)
 
Improvement OLD NEW DELTA RATIO
RandomShuffleLCG2 768 704 -8.3% 1.09x
SuffixAnySequenceLazy 4251 3910 -8.0% 1.09x (?)
Set.isDisjoint.Seq.Box.Empty 127 117 -7.9% 1.09x (?)
Array2D 7520 6928 -7.9% 1.09x (?)
ObjectiveCBridgeStubFromNSDateRef 4090 3770 -7.8% 1.08x (?)
Data.hash.Empty 77 71 -7.8% 1.08x (?)
RemoveWhereSwapInts 67 62 -7.5% 1.08x (?)
MapReduce 397 368 -7.3% 1.08x
MapReduceAnyCollection 398 369 -7.3% 1.08x (?)
FlattenListLoop 5189 4821 -7.1% 1.08x (?)
Set.isSubset.Seq.Int.Empty 217 202 -6.9% 1.07x (?)
Set.isDisjoint.Seq.Int.Empty 91 85 -6.6% 1.07x (?)
Set.isSuperset.Seq.Empty.Int 91 85 -6.6% 1.07x

Code size: -O

Performance: -Osize

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeToNSString 378 1603 +324.1% 0.24x
NSStringConversion.Rebridge 206 518 +151.5% 0.40x
ObjectiveCBridgeToNSArray 14650 27150 +85.3% 0.54x
NSStringConversion.Rebridge.Mutable 792 1465 +85.0% 0.54x
ObjectiveCBridgeStubToNSString 2380 4220 +77.3% 0.56x
SevenBoom 866 1479 +70.8% 0.59x
ObjectiveCBridgeToNSSet 18800 32050 +70.5% 0.59x
NSError 233 356 +52.8% 0.65x
ObjectiveCBridgeStubToArrayOfNSString2 4020 6140 +52.7% 0.65x
DictionaryBridgeToObjC_Access 901 1199 +33.1% 0.75x (?)
DictionaryBridge 869 1051 +20.9% 0.83x (?)
ObjectiveCBridgeStubURLAppendPath2 2530 2930 +15.8% 0.86x (?)
ObjectiveCBridgeStubURLAppendPathRef2 2470 2790 +13.0% 0.89x (?)
JSONPerfEncode 580 648 +11.7% 0.90x (?)
PlistPerfEncode 510 567 +11.2% 0.90x (?)
IterateData 1326 1458 +10.0% 0.91x
 
Improvement OLD NEW DELTA RATIO
ObjectiveCBridgeStubFromNSDateRef 4190 3760 -10.3% 1.11x (?)
Set.isDisjoint.Int.Empty 168 152 -9.5% 1.11x (?)
Set.isSubset.Int.Empty 98 90 -8.2% 1.09x (?)
RemoveWhereMoveInts 37 34 -8.1% 1.09x (?)
Array2D 7520 6928 -7.9% 1.09x (?)
Data.hash.Empty 77 71 -7.8% 1.08x
RemoveWhereSwapInts 65 60 -7.7% 1.08x
NormalizedIterator_fastPrenormal 1070 990 -7.5% 1.08x
FlattenListLoop 5277 4907 -7.0% 1.08x (?)
Set.isSubset.Seq.Int.Empty 217 202 -6.9% 1.07x (?)
Set.isStrictSubset.Seq.Int.Empty 220 205 -6.8% 1.07x (?)
String.replaceSubrange.String.Small 90 84 -6.7% 1.07x (?)
Set.isDisjoint.Seq.Box.Empty 168 157 -6.5% 1.07x (?)

Code size: -Osize

Performance: -Onone

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeToNSString 451 1695 +275.8% 0.27x
NSStringConversion.Rebridge 232 547 +135.8% 0.42x
ObjectiveCBridgeToNSArray 14900 27450 +84.2% 0.54x
NSStringConversion.Rebridge.Mutable 873 1518 +73.9% 0.58x
ObjectiveCBridgeStubToNSString 2480 4290 +73.0% 0.58x
ObjectiveCBridgeToNSSet 19800 32450 +63.9% 0.61x
SevenBoom 990 1616 +63.2% 0.61x
ObjectiveCBridgeStubToArrayOfNSString2 4020 6160 +53.2% 0.65x (?)
DictionaryBridgeToObjC_Access 1036 1416 +36.7% 0.73x (?)
NSError 598 727 +21.6% 0.82x
ObjectiveCBridgeStubURLAppendPath2 2630 3140 +19.4% 0.84x (?)
DictionaryBridge 966 1148 +18.8% 0.84x (?)
ObjectiveCBridgeStubURLAppendPathRef2 2610 3030 +16.1% 0.86x (?)
PlistPerfEncode 532 594 +11.7% 0.90x (?)
JSONPerfEncode 613 674 +10.0% 0.91x (?)
DictionaryOfAnyHashableStrings_insert 7350 7952 +8.2% 0.92x (?)
 
Improvement OLD NEW DELTA RATIO
FloatingPointPrinting_Float_interpolated 58800 53600 -8.8% 1.10x (?)
ArrayOfGenericPOD2 1434 1319 -8.0% 1.09x (?)
EqualStringSubstring 51 47 -7.8% 1.09x (?)
Data.hash.Empty 154 142 -7.8% 1.08x (?)
ArrayOfPOD 1144 1061 -7.3% 1.08x (?)
CSVParsingAlt2 2673 2486 -7.0% 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

ok I profiled this and apparently the protocol ends up getting boxed or something wacky, so the work being done is totally unrelated to the objc overhead. That's… somewhat promising I guess. Means I don't have to throw out the whole approach.

@Catfish-Man
Copy link
Contributor Author

@swift-ci please smoke test

1 similar comment
@Catfish-Man
Copy link
Contributor Author

@swift-ci please smoke test

@Catfish-Man
Copy link
Contributor Author

@swift-ci please smoke benchmark

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeToNSString 362 402 +11.0% 0.90x (?)
 
Improvement OLD NEW DELTA RATIO
String.data.Medium 95 87 -8.4% 1.09x (?)
NormalizedIterator_fastPrenormal 1060 990 -6.6% 1.07x (?)

Code size: -O

Performance: -Osize

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeToNSString 378 419 +10.8% 0.90x

Code size: -Osize

Performance: -Onone

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeToNSString 451 491 +8.9% 0.92x (?)
ObjectiveCBridgeStubFromNSDateRef 4310 4670 +8.4% 0.92x (?)
 
Improvement OLD NEW DELTA RATIO
EqualStringSubstring 51 47 -7.8% 1.09x (?)
ArrayOfPOD 1144 1064 -7.0% 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

BOOM

@Catfish-Man Catfish-Man marked this pull request as ready for review August 10, 2019 06:47
@Catfish-Man Catfish-Man self-assigned this Aug 10, 2019
@Catfish-Man Catfish-Man requested a review from milseman August 10, 2019 06:48
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This selector has to start with "new" to get swiftc to not autorelease the return value

Copy link
Contributor

Choose a reason for hiding this comment

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

Are the trailing underscores intended to convey privateness without screwing up the new prefix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Casting directly to AnyObject here causes swiftc to emit a bridging call to bridge the optional out to objc; using an objc type explicitly avoids that

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest translating these PR comments to source code comments to lessen the pain of future generations. This all seems like valuable info.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unclear what exactly I'm claiming is not being released here, but it does cause something to not be retain-released

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using '__StringStorage.self as AnyClass' instead of my original '_StringSelectorHolder.self as AnyObject' avoids a bunch of machinery that appeared to be boxing something.

Unfortunately it still emits a metadata accessor call that costs about 2/3 as much as objc_msgSend, but I haven't found a good way to avoid that yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When we switch to _CFStringCreateTaggedPointerString this will start returning nil more

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest translating these PR comments to source code comments to lessen the pain of future generations. This all seems like valuable info.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are the trailing underscores intended to convey privateness without screwing up the new prefix?

@Catfish-Man
Copy link
Contributor Author

@swift-ci please smoke test and merge

1 similar comment
@Catfish-Man
Copy link
Contributor Author

@swift-ci please smoke test and merge

@Catfish-Man
Copy link
Contributor Author

Ugh, it claims it failed but I can't find the failure. Gonna re-run it

@Catfish-Man
Copy link
Contributor Author

@swift-ci please smoke test

@Catfish-Man Catfish-Man merged commit bd3643a into swiftlang:master Aug 13, 2019
@Catfish-Man Catfish-Man deleted the shadow-backflip branch August 13, 2019 03:00
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