Skip to content

Speed up Set/Dictionary init from Sequence #5267

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
Oct 19, 2016
Merged

Conversation

dabrahams
Copy link
Contributor

Hopefully, a better version of #5264

radar rdar://problem/27513079

9a2783f regressed the performance of some benchmarks by over 2X

@dabrahams
Copy link
Contributor Author

@swift-ci Please benchmark

@swift-ci
Copy link
Contributor

Build comment file:

Optimized (O)

Regression (0)

Improvement (5)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
Calculator 33 31 -6.1% 1.06x
ClassArrayGetter 13 12 -7.7% 1.08x(?)
MapReduce 372 341 -8.3% 1.09x
ObjectiveCBridgeStubDateAccess 220 182 -17.3% 1.21x
ObjectiveCBridgeFromNSSetAnyObject 261116 207591 -20.5% 1.26x

No Changes (131)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
ObjectiveCBridgeFromNSArrayAnyObjectToString 123114 118457 -3.8% 1.04x(?)
StrToInt 4955 4815 -2.8% 1.03x
135 3133534 3063461 -2.2% 1.02x
ObjectiveCBridgeStubToNSDate 13419 13218 -1.5% 1.02x(?)
StringInterpolation 11025 10762 -2.4% 1.02x(?)
ObjectiveCBridgeToNSSet 15820 15522 -1.9% 1.02x(?)
IterateData 2600 2544 -2.1% 1.02x
DictionaryRemove 4664 4592 -1.5% 1.02x(?)
ObjectiveCBridgeFromNSSetAnyObjectToString 146180 143549 -1.8% 1.02x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 92388 90878 -1.6% 1.02x(?)
ObjectiveCBridgeStubFromNSDate 3350 3290 -1.8% 1.02x(?)
StackPromo 21552 21345 -1.0% 1.01x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 213005 211278 -0.8% 1.01x(?)
AnyHashableWithAClass 63651 62949 -1.1% 1.01x(?)
DictionaryBridge 3806 3782 -0.6% 1.01x(?)
StringHasSuffix 720 712 -1.1% 1.01x(?)
ErrorHandling 2948 2932 -0.5% 1.01x(?)
ObjectiveCBridgeStubToNSDateRef 3290 3251 -1.2% 1.01x(?)
CaptureProp 4214 4192 -0.5% 1.01x(?)
ObjectiveCBridgeFromNSArrayAnyObject 76325 75915 -0.5% 1.01x(?)
ObjectiveCBridgeToNSDictionary 16063 15862 -1.2% 1.01x(?)
MonteCarloE 10512 10450 -0.6% 1.01x(?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 107713 106554 -1.1% 1.01x(?)
NSStringConversion 807 799 -1.0% 1.01x(?)
ObjectiveCBridgeStubNSDataAppend 2410 2388 -0.9% 1.01x(?)
ObjectiveCBridgeStubFromArrayOfNSString 59159 58445 -1.2% 1.01x(?)
TwoSum 1590 1575 -0.9% 1.01x(?)
ObjectiveCBridgeToNSString 1076 1075 -0.1% 1.00x(?)
DictionarySwapOfObjects 6763 6759 -0.1% 1.00x(?)
ObjectiveCBridgeFromNSDictionaryAnyObject 201681 201635 -0.0% 1.00x(?)
RecursiveOwnedParameter 1937 1938 +0.1% 1.00x(?)
ObjectiveCBridgeStubToNSString 1282 1279 -0.2% 1.00x(?)
Array2D 2030 2032 +0.1% 1.00x(?)
Histogram 656 657 +0.1% 1.00x(?)
SortStrings 1756 1756 +0.0% 1.00x
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 5333 5316 -0.3% 1.00x(?)
ObjectiveCBridgeStubFromNSDateRef 3742 3740 -0.1% 1.00x(?)
MonteCarloPi 44998 45209 +0.5% 1.00x
StringWithCString 150401 150426 +0.0% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 6104 6120 +0.3% 1.00x(?)
ObjectiveCBridgeFromNSStringForced 2648 2653 +0.2% 1.00x(?)
Prims 719 719 +0.0% 1.00x
SortLettersInPlace 969 973 +0.4% 1.00x(?)
DictionarySwap 629 627 -0.3% 1.00x
PopFrontArray 1114 1115 +0.1% 1.00x(?)
ArrayOfGenericPOD 220 220 +0.0% 1.00x
Dictionary3OfObjects 856 858 +0.2% 1.00x(?)
RangeAssignment 274 274 +0.0% 1.00x
StringHasPrefix 609 609 +0.0% 1.00x
ByteSwap 0 0 +0.0% 1.00x
SuperChars 209845 209784 -0.0% 1.00x(?)
XorLoop 380 380 +0.0% 1.00x
Integrate 247 247 +0.0% 1.00x
ObjectiveCBridgeStubFromNSStringRef 128 128 +0.0% 1.00x
ObjectiveCBridgeStubFromNSString 772 771 -0.1% 1.00x(?)
ProtocolDispatch 3039 3040 +0.0% 1.00x(?)
ObjectAllocation 153 153 +0.0% 1.00x
TypeFlood 0 0 +0.0% 1.00x
Dictionary3 508 510 +0.4% 1.00x(?)
Dictionary2 2042 2034 -0.4% 1.00x(?)
StrComplexWalk 2894 2880 -0.5% 1.00x(?)
SetIntersect_OfObjects 2277 2276 -0.0% 1.00x(?)
Join 464 465 +0.2% 1.00x(?)
ArrayOfRef 3539 3550 +0.3% 1.00x(?)
ObjectiveCBridgeStubURLAppendPathRef 238123 238630 +0.2% 1.00x(?)
ObjectiveCBridgeStubDateMutation 273 273 +0.0% 1.00x
NSError 325 325 +0.0% 1.00x
DictionaryOfObjects 2284 2286 +0.1% 1.00x(?)
PopFrontArrayGeneric 1117 1114 -0.3% 1.00x(?)
PopFrontUnsafePointer 9178 9173 -0.1% 1.00x(?)
StringEqualPointerComparison 7341 7343 +0.0% 1.00x(?)
PolymorphicCalls 22 22 +0.0% 1.00x
ObjectiveCBridgeStubToNSStringRef 116 116 +0.0% 1.00x
DictionaryLiteral 2750 2756 +0.2% 1.00x(?)
OpenClose 54 54 +0.0% 1.00x
DictionaryRemoveOfObjects 19694 19714 +0.1% 1.00x(?)
UTF8Decode 288 288 +0.0% 1.00x
ObjectiveCBridgeStubURLAppendPath 237364 237560 +0.1% 1.00x(?)
SortStringsUnicode 8144 8167 +0.3% 1.00x(?)
SetIsSubsetOf 508 508 +0.0% 1.00x
Dictionary 756 756 +0.0% 1.00x
NopDeinit 36636 36629 -0.0% 1.00x(?)
ObjectiveCBridgeStubToArrayOfNSString 29160 29049 -0.4% 1.00x(?)
SetIntersect 1084 1084 +0.0% 1.00x
NSDictionaryCastToSwift 6965 6982 +0.2% 1.00x(?)
RGBHistogramOfObjects 21947 21996 +0.2% 1.00x(?)
ObjectiveCBridgeStubNSDateRefAccess 308 308 +0.0% 1.00x
StringBuilder 1322 1321 -0.1% 1.00x(?)
ArrayOfGenericRef 3615 3603 -0.3% 1.00x(?)
ObjectiveCBridgeFromNSString 1766 1770 +0.2% 1.00x(?)
Sim2DArray 277 277 +0.0% 1.00x
SetUnion_OfObjects 6545 6542 -0.1% 1.00x(?)
StringHasSuffixUnicode 63236 63260 +0.0% 1.00x(?)
HashTest 1748 1752 +0.2% 1.00x(?)
SetIsSubsetOf_OfObjects 524 524 +0.0% 1.00x
ArrayAppend 772 772 +0.0% 1.00x
StringHasPrefixUnicode 14179 14185 +0.0% 1.00x(?)
LinkedList 7256 7251 -0.1% 1.00x(?)
RGBHistogram 2833 2830 -0.1% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectForced 4610 4614 +0.1% 1.00x(?)
ArrayValueProp4 6 6 +0.0% 1.00x
ArrayOfPOD 182 182 +0.0% 1.00x
SetUnion 3042 3044 +0.1% 1.00x(?)
Chars 625 625 +0.0% 1.00x
DeadArray 182 182 +0.0% 1.00x
BitCount 1 1 +0.0% 1.00x
ArrayLiteral 1176 1179 +0.3% 1.00x(?)
SevenBoom 1355 1352 -0.2% 1.00x(?)
StringWalk 5883 5882 -0.0% 1.00x(?)
ArrayValueProp 6 6 +0.0% 1.00x
GlobalClass 0 0 +0.0% 1.00x
Memset 235 235 +0.0% 1.00x
Dictionary2OfObjects 3393 3410 +0.5% 1.00x(?)
ArrayAppendReserved 536 535 -0.2% 1.00x(?)
ArrayValueProp2 6 6 +0.0% 1.00x
ArrayValueProp3 6 6 +0.0% 1.00x
ArraySubscript 1412 1424 +0.8% 0.99x(?)
StaticArray 2797 2827 +1.1% 0.99x(?)
AngryPhonebook 2798 2817 +0.7% 0.99x(?)
ProtocolDispatch2 158 159 +0.6% 0.99x(?)
RC4 164 165 +0.6% 0.99x
Hanoi 3170 3200 +0.9% 0.99x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 137293 138282 +0.7% 0.99x(?)
ObjectiveCBridgeStubDataAppend 2982 3004 +0.7% 0.99x(?)
SetExclusiveOr 2651 2666 +0.6% 0.99x(?)
Phonebook 7047 7085 +0.5% 0.99x(?)
SetExclusiveOr_OfObjects 7788 7833 +0.6% 0.99x(?)
ObjectiveCBridgeStubNSDateMutationRef 11747 11905 +1.4% 0.99x(?)
ObjectiveCBridgeToNSArray 29612 30163 +1.9% 0.98x(?)
ArrayInClass 62 63 +1.6% 0.98x(?)
Walsh 309 318 +2.9% 0.97x
**Unoptimized (Onone)**

Regression (0)

Improvement (2)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
TypeFlood 193 172 -10.9% 1.12x(?)
ObjectiveCBridgeFromNSSetAnyObject 270611 217809 -19.5% 1.24x

No Changes (134)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
ObjectiveCBridgeStubFromArrayOfNSString 61405 58444 -4.8% 1.05x(?)
StackPromo 129919 126594 -2.6% 1.03x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 224019 218142 -2.6% 1.03x(?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 10416 10133 -2.7% 1.03x(?)
NSError 695 675 -2.9% 1.03x(?)
ObjectiveCBridgeStubURLAppendPath 242036 237510 -1.9% 1.02x(?)
ObjectiveCBridgeStubFromNSDate 3859 3778 -2.1% 1.02x
ObjectiveCBridgeFromNSDictionaryAnyObject 211618 208616 -1.4% 1.01x(?)
135 5706591 5650468 -1.0% 1.01x
DictionaryBridge 3936 3914 -0.6% 1.01x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 7780 7701 -1.0% 1.01x(?)
PopFrontArray 24038 23895 -0.6% 1.01x(?)
StringInterpolation 15856 15679 -1.1% 1.01x(?)
ObjectiveCBridgeStubFromNSStringRef 166 165 -0.6% 1.01x(?)
StaticArray 35601 35361 -0.7% 1.01x(?)
ObjectiveCBridgeToNSSet 16423 16269 -0.9% 1.01x(?)
ObjectiveCBridgeToNSArray 30670 30363 -1.0% 1.01x(?)
PolymorphicCalls 1139 1129 -0.9% 1.01x(?)
Hanoi 20469 20351 -0.6% 1.01x(?)
SortStringsUnicode 9202 9101 -1.1% 1.01x(?)
ObjectiveCBridgeStubToArrayOfNSString 29583 29422 -0.5% 1.01x(?)
ObjectiveCBridgeFromNSArrayAnyObject 79665 78510 -1.4% 1.01x(?)
Phonebook 63464 62888 -0.9% 1.01x(?)
ObjectiveCBridgeFromNSSetAnyObjectToString 162602 161714 -0.6% 1.01x(?)
ObjectiveCBridgeStubNSDataAppend 2909 2873 -1.2% 1.01x
BitCount 104 103 -1.0% 1.01x
Dictionary2OfObjects 6254 6211 -0.7% 1.01x(?)
ArraySubscript 5604 5607 +0.1% 1.00x(?)
ObjectiveCBridgeToNSString 1107 1109 +0.2% 1.00x(?)
DictionarySwapOfObjects 21094 21064 -0.1% 1.00x(?)
RecursiveOwnedParameter 10866 10865 -0.0% 1.00x(?)
ObjectiveCBridgeStubToNSString 1334 1333 -0.1% 1.00x(?)
ClassArrayGetter 1265 1266 +0.1% 1.00x(?)
Array2D 813817 814046 +0.0% 1.00x(?)
SortStrings 2681 2677 -0.1% 1.00x(?)
ObjectiveCBridgeStubFromNSDateRef 4196 4189 -0.2% 1.00x(?)
MonteCarloPi 53746 53735 -0.0% 1.00x(?)
StringWithCString 217247 217223 -0.0% 1.00x(?)
ObjectiveCBridgeFromNSStringForced 3092 3080 -0.4% 1.00x
Prims 13497 13505 +0.1% 1.00x(?)
SortLettersInPlace 2615 2603 -0.5% 1.00x(?)
DictionarySwap 7552 7558 +0.1% 1.00x(?)
ArrayOfGenericPOD 3520 3523 +0.1% 1.00x(?)
Dictionary3OfObjects 2260 2256 -0.2% 1.00x(?)
RangeAssignment 27609 27526 -0.3% 1.00x(?)
StringHasPrefix 1562 1562 +0.0% 1.00x
ByteSwap 9 9 +0.0% 1.00x
SuperChars 260934 261165 +0.1% 1.00x(?)
ObjectiveCBridgeStubToNSDate 14187 14250 +0.4% 1.00x(?)
XorLoop 20004 19996 -0.0% 1.00x(?)
Integrate 369 369 +0.0% 1.00x
Join 1472 1468 -0.3% 1.00x(?)
ProtocolDispatch 5779 5775 -0.1% 1.00x(?)
ObjectAllocation 566 566 +0.0% 1.00x
ArrayLiteral 1246 1246 +0.0% 1.00x
ProtocolDispatch2 444 444 +0.0% 1.00x
HashTest 5394 5395 +0.0% 1.00x(?)
Dictionary3 1606 1607 +0.1% 1.00x(?)
Dictionary2 4414 4403 -0.2% 1.00x(?)
StrComplexWalk 8295 8321 +0.3% 1.00x(?)
SetIntersect_OfObjects 13852 13913 +0.4% 1.00x
ErrorHandling 3828 3836 +0.2% 1.00x(?)
ArrayOfRef 9474 9474 +0.0% 1.00x
ObjectiveCBridgeStubURLAppendPathRef 243537 243438 -0.0% 1.00x(?)
ObjectiveCBridgeStubDateMutation 547 547 +0.0% 1.00x
DictionaryOfObjects 4886 4881 -0.1% 1.00x(?)
PopFrontArrayGeneric 9621 9576 -0.5% 1.00x(?)
PopFrontUnsafePointer 258955 258760 -0.1% 1.00x(?)
StringEqualPointerComparison 9640 9677 +0.4% 1.00x
RC4 9376 9371 -0.1% 1.00x(?)
ObjectiveCBridgeStubToNSStringRef 156 156 +0.0% 1.00x
Calculator 1050 1050 +0.0% 1.00x
MapReduce 45451 45522 +0.2% 1.00x
AngryPhonebook 2972 2971 -0.0% 1.00x(?)
IterateData 10796 10751 -0.4% 1.00x(?)
OpenClose 433 431 -0.5% 1.00x(?)
DictionaryRemoveOfObjects 47057 47051 -0.0% 1.00x(?)
UTF8Decode 43550 43497 -0.1% 1.00x
SetIsSubsetOf 2447 2446 -0.0% 1.00x(?)
Dictionary 2142 2140 -0.1% 1.00x(?)
NopDeinit 59538 59606 +0.1% 1.00x(?)
SetIntersect 15254 15300 +0.3% 1.00x(?)
NSDictionaryCastToSwift 8426 8434 +0.1% 1.00x(?)
RGBHistogramOfObjects 93409 93489 +0.1% 1.00x(?)
ObjectiveCBridgeStubNSDateRefAccess 1260 1261 +0.1% 1.00x(?)
StrToInt 5246 5244 -0.0% 1.00x(?)
ArrayInClass 3956 3957 +0.0% 1.00x(?)
StringHasSuffix 1629 1622 -0.4% 1.00x(?)
Sim2DArray 14568 14579 +0.1% 1.00x(?)
SetExclusiveOr_OfObjects 46804 46877 +0.2% 1.00x(?)
MonteCarloE 110207 110124 -0.1% 1.00x(?)
SetUnion_OfObjects 34347 34394 +0.1% 1.00x(?)
StringHasSuffixUnicode 64955 64870 -0.1% 1.00x(?)
Walsh 13124 13135 +0.1% 1.00x(?)
SetIsSubsetOf_OfObjects 2206 2213 +0.3% 1.00x(?)
ArrayAppend 3672 3674 +0.1% 1.00x(?)
DictionaryRemove 17424 17404 -0.1% 1.00x(?)
StringHasPrefixUnicode 15516 15514 -0.0% 1.00x(?)
LinkedList 27879 27937 +0.2% 1.00x(?)
NSStringConversion 2967 2962 -0.2% 1.00x(?)
RGBHistogram 43996 44091 +0.2% 1.00x(?)
ArrayValueProp4 3012 3002 -0.3% 1.00x(?)
ArrayOfPOD 2512 2511 -0.0% 1.00x(?)
SetUnion 18373 18384 +0.1% 1.00x(?)
Chars 5021 4999 -0.4% 1.00x
StringBuilder 2773 2766 -0.2% 1.00x(?)
DeadArray 122171 121889 -0.2% 1.00x(?)
AnyHashableWithAClass 77521 77480 -0.1% 1.00x(?)
SevenBoom 1520 1515 -0.3% 1.00x(?)
ArrayValueProp 2618 2617 -0.0% 1.00x(?)
GlobalClass 0 0 +0.0% 1.00x
Memset 20650 20657 +0.0% 1.00x(?)
ArrayAppendReserved 3561 3567 +0.2% 1.00x(?)
TwoSum 6539 6551 +0.2% 1.00x(?)
ArrayValueProp2 3141 3143 +0.1% 1.00x(?)
ArrayValueProp3 3072 3075 +0.1% 1.00x(?)
Histogram 11672 11765 +0.8% 0.99x(?)
ObjectiveCBridgeStubFromNSString 816 824 +1.0% 0.99x(?)
ObjectiveCBridgeStubToNSDateRef 3345 3384 +1.2% 0.99x(?)
CaptureProp 116433 117080 +0.6% 0.99x
DictionaryLiteral 16745 16853 +0.6% 0.99x(?)
SetExclusiveOr 30451 30620 +0.6% 0.99x(?)
ArrayOfGenericRef 10137 10198 +0.6% 0.99x(?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 118794 119785 +0.8% 0.99x(?)
ObjectiveCBridgeFromNSSetAnyObjectForced 7464 7539 +1.0% 0.99x(?)
StringWalk 21121 21314 +0.9% 0.99x
ObjectiveCBridgeFromNSString 5029 5070 +0.8% 0.99x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 124220 126189 +1.6% 0.98x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 141404 144351 +2.1% 0.98x(?)
ObjectiveCBridgeStubDataAppend 3344 3397 +1.6% 0.98x(?)
ObjectiveCBridgeStubNSDateMutationRef 14401 14696 +2.0% 0.98x(?)
ObjectiveCBridgeStubDateAccess 1108 1147 +3.5% 0.97x
ObjectiveCBridgeToNSDictionary 15923 16421 +3.1% 0.97x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 92564 95119 +2.8% 0.97x(?)
**Hardware Overview** Model Name: Mac mini Model Identifier: Macmini7,1 Processor Name: Intel Core i5 Processor Speed: 2.8 GHz Number of Processors: 1 Total Number of Cores: 2 L2 Cache (per Core): 256 KB L3 Cache: 3 MB Memory: 16 GB

@jdfweb
Copy link

jdfweb commented Oct 13, 2016

Nice

@moiseev
Copy link
Contributor

moiseev commented Oct 17, 2016

@swift-ci Please smoke test

@moiseev
Copy link
Contributor

moiseev commented Oct 19, 2016

@dabrahams Ready to merge?

@dabrahams dabrahams merged commit 76b5afc into master Oct 19, 2016
@dabrahams dabrahams deleted the dabrahams-patch-2 branch October 19, 2016 17:23
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