Skip to content

⚠️Add a new TempRValue optimization to the CopyForwarding pass. #11328

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

Closed
wants to merge 3 commits into from
Closed

⚠️Add a new TempRValue optimization to the CopyForwarding pass. #11328

wants to merge 3 commits into from

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Aug 3, 2017

This is a separate optimization that detects short-lived temporaries that can be
eliminated. This is necessary now that SILGen no longer performs basic RValue
forwarding in some cases.

SR-5508: Performance regression in benchmarks caused by removing SILGen peephole
for LoadExpr in +0 context

This is a separate optimization that detects short-lived temporaries that can be
eliminated. This is necessary now that SILGen no longer performs basic RValue
forwarding in some cases.

SR-5508: Performance regression in benchmarks caused by removing SILGen peephole
for LoadExpr in +0 context
@atrick
Copy link
Contributor Author

atrick commented Aug 3, 2017

@swift-ci test.

@atrick
Copy link
Contributor Author

atrick commented Aug 3, 2017

@swift-ci benchmark.

@swift-ci
Copy link
Contributor

swift-ci commented Aug 3, 2017

Build comment file:

Optimized (O)

Regression (5)
TEST OLD NEW DELTA SPEEDUP
DropFirstSequenceLazy 2739 3688 +34.6% 0.74x
DropFirstSequence 2813 3688 +31.1% 0.76x
Calculator 31 33 +6.5% 0.94x
ArrayAppendAscii 18593 19767 +6.3% 0.94x
PopFrontUnsafePointer 8979 9521 +6.0% 0.94x (?)
Improvement (4)
TEST OLD NEW DELTA SPEEDUP
DropFirstAnySequence 9619 7746 -19.5% 1.24x
DropFirstAnySequenceLazy 9616 7749 -19.4% 1.24x
PrefixAnySequenceLazy 8057 6606 -18.0% 1.22x
PrefixAnySequence 8057 6614 -17.9% 1.22x
No Changes (318)
TEST OLD NEW DELTA SPEEDUP
AngryPhonebook 2936 2953 +0.6% 0.99x (?)
AnyHashableWithAClass 66322 66514 +0.3% 1.00x (?)
Array2D 2039 2042 +0.1% 1.00x (?)
ArrayAppend 769 769 +0.0% 1.00x
ArrayAppendArrayOfInt 597 600 +0.5% 1.00x
ArrayAppendFromGeneric 597 597 +0.0% 1.00x
ArrayAppendGenericStructs 1233 1216 -1.4% 1.01x (?)
ArrayAppendLatin1 40462 40139 -0.8% 1.01x (?)
ArrayAppendLazyMap 995 994 -0.1% 1.00x (?)
ArrayAppendOptionals 1229 1231 +0.2% 1.00x (?)
ArrayAppendRepeatCol 837 837 +0.0% 1.00x
ArrayAppendReserved 532 533 +0.2% 1.00x (?)
ArrayAppendSequence 942 940 -0.2% 1.00x (?)
ArrayAppendStrings 13659 13643 -0.1% 1.00x (?)
ArrayAppendToFromGeneric 597 597 +0.0% 1.00x
ArrayAppendToGeneric 597 597 +0.0% 1.00x
ArrayAppendUTF16 39788 40188 +1.0% 0.99x (?)
ArrayInClass 61 61 +0.0% 1.00x
ArrayLiteral 1208 1210 +0.2% 1.00x (?)
ArrayOfGenericPOD 219 219 +0.0% 1.00x
ArrayOfGenericRef 4014 4012 -0.0% 1.00x (?)
ArrayOfPOD 166 166 +0.0% 1.00x
ArrayOfRef 3907 3901 -0.2% 1.00x (?)
ArrayPlusEqualArrayOfInt 596 597 +0.2% 1.00x
ArrayPlusEqualFiveElementCollection 4925 4918 -0.1% 1.00x (?)
ArrayPlusEqualSingleElementCollection 768 768 +0.0% 1.00x
ArrayPlusEqualThreeElements 1606 1624 +1.1% 0.99x (?)
ArraySubscript 1500 1497 -0.2% 1.00x (?)
ArrayValueProp 6 6 +0.0% 1.00x
ArrayValueProp2 6 6 +0.0% 1.00x
ArrayValueProp3 6 6 +0.0% 1.00x
ArrayValueProp4 6 6 +0.0% 1.00x
BitCount 148 148 +0.0% 1.00x
ByteSwap 118 117 -0.8% 1.01x
CStringLongAscii 4640 4766 +2.7% 0.97x
CStringLongNonAscii 2147 2195 +2.2% 0.98x (?)
CStringShortAscii 4770 4737 -0.7% 1.01x (?)
CaptureProp 4851 4852 +0.0% 1.00x (?)
CharIndexing_ascii_unicodeScalars 14217 14216 -0.0% 1.00x (?)
CharIndexing_ascii_unicodeScalars_Backwards 11674 11674 +0.0% 1.00x
CharIndexing_chinese_unicodeScalars 10771 10771 +0.0% 1.00x
CharIndexing_chinese_unicodeScalars_Backwards 8862 8854 -0.1% 1.00x (?)
CharIndexing_japanese_unicodeScalars 17009 17009 +0.0% 1.00x
CharIndexing_japanese_unicodeScalars_Backwards 13952 13958 +0.0% 1.00x (?)
CharIndexing_korean_unicodeScalars 13786 13785 -0.0% 1.00x (?)
CharIndexing_korean_unicodeScalars_Backwards 11324 11318 -0.1% 1.00x (?)
CharIndexing_punctuatedJapanese_unicodeScalars 2592 2592 +0.0% 1.00x
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 2175 2180 +0.2% 1.00x (?)
CharIndexing_punctuated_unicodeScalars 3237 3237 +0.0% 1.00x
CharIndexing_punctuated_unicodeScalars_Backwards 2699 2705 +0.2% 1.00x (?)
CharIndexing_russian_unicodeScalars 11853 11853 +0.0% 1.00x
CharIndexing_russian_unicodeScalars_Backwards 9735 9740 +0.1% 1.00x (?)
CharIndexing_tweet_unicodeScalars 28045 28044 -0.0% 1.00x (?)
CharIndexing_tweet_unicodeScalars_Backwards 22979 22979 +0.0% 1.00x
CharIndexing_utf16_unicodeScalars 77204 77202 -0.0% 1.00x (?)
CharIndexing_utf16_unicodeScalars_Backwards 76461 76472 +0.0% 1.00x (?)
CharIteration_ascii_unicodeScalars 16025 16215 +1.2% 0.99x
CharIteration_ascii_unicodeScalars_Backwards 16767 16768 +0.0% 1.00x (?)
CharIteration_chinese_unicodeScalars 12138 12284 +1.2% 0.99x
CharIteration_chinese_unicodeScalars_Backwards 12694 12694 +0.0% 1.00x
CharIteration_japanese_unicodeScalars 19180 19413 +1.2% 0.99x
CharIteration_japanese_unicodeScalars_Backwards 20077 20077 +0.0% 1.00x
CharIteration_korean_unicodeScalars 15537 15725 +1.2% 0.99x
CharIteration_korean_unicodeScalars_Backwards 16259 16258 -0.0% 1.00x (?)
CharIteration_punctuatedJapanese_unicodeScalars 2912 2945 +1.1% 0.99x
CharIteration_punctuatedJapanese_unicodeScalars_Backwards 3019 3018 -0.0% 1.00x (?)
CharIteration_punctuated_unicodeScalars 3638 3675 +1.0% 0.99x (?)
CharIteration_punctuated_unicodeScalars_Backwards 3783 3783 +0.0% 1.00x
CharIteration_russian_unicodeScalars 13352 13513 +1.2% 0.99x (?)
CharIteration_russian_unicodeScalars_Backwards 13966 13966 +0.0% 1.00x
CharIteration_tweet_unicodeScalars 31617 31984 +1.2% 0.99x
CharIteration_tweet_unicodeScalars_Backwards 33177 33184 +0.0% 1.00x (?)
CharIteration_utf16_unicodeScalars 91470 91584 +0.1% 1.00x (?)
CharIteration_utf16_unicodeScalars_Backwards 113797 113730 -0.1% 1.00x (?)
CharacterLiteralsLarge 5997 6005 +0.1% 1.00x (?)
CharacterLiteralsSmall 404 404 +0.0% 1.00x
Chars 420 417 -0.7% 1.01x (?)
ClassArrayGetter 13 13 +0.0% 1.00x
DeadArray 186 186 +0.0% 1.00x
Dictionary 554 555 +0.2% 1.00x (?)
Dictionary2 1836 1837 +0.1% 1.00x (?)
Dictionary2OfObjects 3294 3288 -0.2% 1.00x (?)
Dictionary3 441 442 +0.2% 1.00x (?)
Dictionary3OfObjects 888 886 -0.2% 1.00x (?)
DictionaryBridge 2553 2538 -0.6% 1.01x (?)
DictionaryGroup 271 271 +0.0% 1.00x
DictionaryGroupOfObjects 1785 1787 +0.1% 1.00x (?)
DictionaryLiteral 1478 1475 -0.2% 1.00x (?)
DictionaryOfObjects 2335 2332 -0.1% 1.00x (?)
DictionaryRemove 2476 2473 -0.1% 1.00x (?)
DictionaryRemoveOfObjects 23485 23527 +0.2% 1.00x (?)
DictionarySwap 432 432 +0.0% 1.00x
DictionarySwapOfObjects 7521 7513 -0.1% 1.00x (?)
DropFirstAnyCollection 55 55 +0.0% 1.00x
DropFirstAnyCollectionLazy 45723 45772 +0.1% 1.00x (?)
DropFirstAnySeqCRangeIter 29123 28434 -2.4% 1.02x
DropFirstAnySeqCRangeIterLazy 29114 28435 -2.3% 1.02x (?)
DropFirstAnySeqCntRange 50 50 +0.0% 1.00x
DropFirstAnySeqCntRangeLazy 50 50 +0.0% 1.00x
DropFirstArray 24 25 +4.2% 0.96x
DropFirstArrayLazy 25 24 -4.0% 1.04x
DropFirstCountableRange 32 32 +0.0% 1.00x
DropFirstCountableRangeLazy 32 32 +0.0% 1.00x
DropLastAnyCollection 19 19 +0.0% 1.00x
DropLastAnyCollectionLazy 15279 15281 +0.0% 1.00x (?)
DropLastAnySeqCRangeIter 5976 5967 -0.2% 1.00x (?)
DropLastAnySeqCRangeIterLazy 6008 5976 -0.5% 1.01x (?)
DropLastAnySeqCntRange 10 10 +0.0% 1.00x
DropLastAnySeqCntRangeLazy 10 10 +0.0% 1.00x
DropLastAnySequence 8701 8669 -0.4% 1.00x (?)
DropLastAnySequenceLazy 8542 8565 +0.3% 1.00x (?)
DropLastArray 8 8 +0.0% 1.00x
DropLastArrayLazy 8 8 +0.0% 1.00x
DropLastCountableRange 10 10 +0.0% 1.00x
DropLastCountableRangeLazy 10 10 +0.0% 1.00x
DropLastSequence 653 652 -0.2% 1.00x (?)
DropLastSequenceLazy 653 652 -0.2% 1.00x (?)
DropWhileAnyCollection 69 69 +0.0% 1.00x
DropWhileAnyCollectionLazy 103 103 +0.0% 1.00x
DropWhileAnySeqCRangeIter 22728 22355 -1.6% 1.02x (?)
DropWhileAnySeqCRangeIterLazy 103 103 +0.0% 1.00x
DropWhileAnySeqCntRange 64 64 +0.0% 1.00x
DropWhileAnySeqCntRangeLazy 103 103 +0.0% 1.00x
DropWhileAnySequence 8213 8103 -1.3% 1.01x (?)
DropWhileAnySequenceLazy 2733 2733 +0.0% 1.00x
DropWhileArray 37 37 +0.0% 1.00x
DropWhileArrayLazy 78 78 +0.0% 1.00x
DropWhileCountableRange 36 36 +0.0% 1.00x
DropWhileCountableRangeLazy 68 68 +0.0% 1.00x
DropWhileSequence 2108 2108 +0.0% 1.00x
DropWhileSequenceLazy 65 65 +0.0% 1.00x
EqualStringSubstring 385 383 -0.5% 1.01x
EqualSubstringString 385 385 +0.0% 1.00x
EqualSubstringSubstring 391 389 -0.5% 1.01x
EqualSubstringSubstringGenericEquatable 387 387 +0.0% 1.00x
ErrorHandling 2034 2031 -0.1% 1.00x (?)
FilterEvenUsingReduce 1283 1287 +0.3% 1.00x (?)
FilterEvenUsingReduceInto 146 146 +0.0% 1.00x
FrequenciesUsingReduce 7272 7256 -0.2% 1.00x (?)
FrequenciesUsingReduceInto 4225 4225 +0.0% 1.00x
Hanoi 3338 3332 -0.2% 1.00x (?)
HashTest 1695 1701 +0.4% 1.00x (?)
Histogram 305 305 +0.0% 1.00x
Integrate 263 263 +0.0% 1.00x
IterateData 759 759 +0.0% 1.00x
Join 379 376 -0.8% 1.01x (?)
LazilyFilteredArrays 64840 64830 -0.0% 1.00x (?)
LazilyFilteredRange 3886 3888 +0.1% 1.00x (?)
LessSubstringSubstring 384 383 -0.3% 1.00x (?)
LessSubstringSubstringGenericComparable 384 382 -0.5% 1.01x (?)
LinkedList 7101 7101 +0.0% 1.00x
MapReduce 393 391 -0.5% 1.01x (?)
MapReduceAnyCollection 363 363 +0.0% 1.00x
MapReduceAnyCollectionShort 2068 2063 -0.2% 1.00x (?)
MapReduceClass 3054 3053 -0.0% 1.00x (?)
MapReduceClassShort 4580 4578 -0.0% 1.00x (?)
MapReduceLazyCollection 15 15 +0.0% 1.00x
MapReduceLazyCollectionShort 44 44 +0.0% 1.00x
MapReduceLazySequence 90 90 +0.0% 1.00x
MapReduceSequence 437 436 -0.2% 1.00x (?)
MapReduceShort 1990 1983 -0.4% 1.00x (?)
MapReduceShortString 21 21 +0.0% 1.00x
MapReduceString 107 107 +0.0% 1.00x
Memset 234 234 +0.0% 1.00x
MonteCarloE 10441 10369 -0.7% 1.01x
MonteCarloPi 43900 43977 +0.2% 1.00x
NSDictionaryCastToSwift 5316 5367 +1.0% 0.99x (?)
NSError 293 291 -0.7% 1.01x (?)
NSStringConversion 363 364 +0.3% 1.00x (?)
NopDeinit 22897 22889 -0.0% 1.00x (?)
ObjectAllocation 178 178 +0.0% 1.00x
ObjectiveCBridgeFromNSArrayAnyObject 21819 22000 +0.8% 0.99x (?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 3454 3458 +0.1% 1.00x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 38686 38628 -0.1% 1.00x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 32605 32686 +0.2% 1.00x (?)
ObjectiveCBridgeFromNSDictionaryAnyObject 118417 117882 -0.5% 1.00x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 5064 5133 +1.4% 0.99x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 90723 89157 -1.7% 1.02x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 100147 99129 -1.0% 1.01x (?)
ObjectiveCBridgeFromNSSetAnyObject 64053 64308 +0.4% 1.00x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 4210 4212 +0.0% 1.00x (?)
ObjectiveCBridgeFromNSSetAnyObjectToString 67433 67107 -0.5% 1.00x (?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 69693 67762 -2.8% 1.03x (?)
ObjectiveCBridgeFromNSString 991 989 -0.2% 1.00x (?)
ObjectiveCBridgeFromNSStringForced 1841 1842 +0.1% 1.00x (?)
ObjectiveCBridgeStubDataAppend 3787 3750 -1.0% 1.01x (?)
ObjectiveCBridgeStubDateAccess 181 181 +0.0% 1.00x
ObjectiveCBridgeStubDateMutation 272 272 +0.0% 1.00x
ObjectiveCBridgeStubFromArrayOfNSString 24428 24314 -0.5% 1.00x (?)
ObjectiveCBridgeStubFromNSDate 3444 3433 -0.3% 1.00x (?)
ObjectiveCBridgeStubFromNSDateRef 4065 4065 +0.0% 1.00x
ObjectiveCBridgeStubFromNSString 537 544 +1.3% 0.99x (?)
ObjectiveCBridgeStubFromNSStringRef 142 142 +0.0% 1.00x
ObjectiveCBridgeStubNSDataAppend 2371 2367 -0.2% 1.00x (?)
ObjectiveCBridgeStubNSDateMutationRef 12747 12524 -1.7% 1.02x (?)
ObjectiveCBridgeStubNSDateRefAccess 339 339 +0.0% 1.00x
ObjectiveCBridgeStubToArrayOfNSString 28831 28842 +0.0% 1.00x (?)
ObjectiveCBridgeStubToNSDate 14722 14428 -2.0% 1.02x (?)
ObjectiveCBridgeStubToNSDateRef 3237 3217 -0.6% 1.01x (?)
ObjectiveCBridgeStubToNSString 1494 1496 +0.1% 1.00x (?)
ObjectiveCBridgeStubToNSStringRef 108 108 +0.0% 1.00x
ObjectiveCBridgeStubURLAppendPath 218801 224363 +2.5% 0.98x (?)
ObjectiveCBridgeStubURLAppendPathRef 219878 222412 +1.2% 0.99x (?)
ObjectiveCBridgeToNSArray 28553 28814 +0.9% 0.99x (?)
ObjectiveCBridgeToNSDictionary 44939 44589 -0.8% 1.01x (?)
ObjectiveCBridgeToNSSet 39287 39147 -0.4% 1.00x (?)
ObjectiveCBridgeToNSString 1265 1273 +0.6% 0.99x (?)
ObserverClosure 2278 2282 +0.2% 1.00x (?)
ObserverForwarderStruct 1127 1127 +0.0% 1.00x
ObserverPartiallyAppliedMethod 3762 3762 +0.0% 1.00x
ObserverUnappliedMethod 2666 2695 +1.1% 0.99x (?)
OpenClose 48 48 +0.0% 1.00x
Phonebook 5840 5841 +0.0% 1.00x (?)
PolymorphicCalls 22 22 +0.0% 1.00x
PopFrontArray 1226 1226 +0.0% 1.00x
PopFrontArrayGeneric 1228 1229 +0.1% 1.00x (?)
PrefixAnyCollection 55 55 +0.0% 1.00x
PrefixAnyCollectionLazy 45804 45756 -0.1% 1.00x (?)
PrefixAnySeqCRangeIter 22975 22166 -3.5% 1.04x (?)
PrefixAnySeqCRangeIterLazy 22974 22166 -3.5% 1.04x (?)
PrefixAnySeqCntRange 50 50 +0.0% 1.00x
PrefixAnySeqCntRangeLazy 50 50 +0.0% 1.00x
PrefixArray 25 25 +0.0% 1.00x
PrefixArrayLazy 25 25 +0.0% 1.00x
PrefixCountableRange 32 32 +0.0% 1.00x
PrefixCountableRangeLazy 32 32 +0.0% 1.00x
PrefixSequence 2093 2092 -0.0% 1.00x (?)
PrefixSequenceLazy 2037 2036 -0.0% 1.00x (?)
PrefixWhileAnyCollection 95 95 +0.0% 1.00x
PrefixWhileAnyCollectionLazy 75 75 +0.0% 1.00x
PrefixWhileAnySeqCRangeIter 16746 16693 -0.3% 1.00x (?)
PrefixWhileAnySeqCRangeIterLazy 75 75 +0.0% 1.00x
PrefixWhileAnySeqCntRange 90 90 +0.0% 1.00x
PrefixWhileAnySeqCntRangeLazy 75 75 +0.0% 1.00x
PrefixWhileAnySequence 18755 18558 -1.1% 1.01x (?)
PrefixWhileAnySequenceLazy 2181 2181 +0.0% 1.00x
PrefixWhileArray 62 62 +0.0% 1.00x
PrefixWhileArrayLazy 49 49 +0.0% 1.00x
PrefixWhileCountableRange 36 36 +0.0% 1.00x
PrefixWhileCountableRangeLazy 32 32 +0.0% 1.00x
PrefixWhileSequence 324 324 +0.0% 1.00x
PrefixWhileSequenceLazy 28 28 +0.0% 1.00x
Prims 785 787 +0.3% 1.00x (?)
ProtocolDispatch 2424 2424 +0.0% 1.00x
ProtocolDispatch2 161 160 -0.6% 1.01x
RC4 159 159 +0.0% 1.00x
RGBHistogram 2376 2373 -0.1% 1.00x (?)
RGBHistogramOfObjects 23556 23568 +0.1% 1.00x (?)
RangeAssignment 347 347 +0.0% 1.00x
RecursiveOwnedParameter 2315 2318 +0.1% 1.00x (?)
ReversedArray 49 49 +0.0% 1.00x
ReversedBidirectional 30628 30605 -0.1% 1.00x (?)
ReversedDictionary 115 115 +0.0% 1.00x
SetExclusiveOr 3253 3248 -0.2% 1.00x (?)
SetExclusiveOr_OfObjects 8053 8067 +0.2% 1.00x (?)
SetIntersect 306 305 -0.3% 1.00x (?)
SetIntersect_OfObjects 1715 1717 +0.1% 1.00x (?)
SetIsSubsetOf 292 292 +0.0% 1.00x
SetIsSubsetOf_OfObjects 359 359 +0.0% 1.00x
SetUnion 2813 2787 -0.9% 1.01x (?)
SetUnion_OfObjects 6695 6702 +0.1% 1.00x (?)
SevenBoom 1472 1471 -0.1% 1.00x (?)
Sim2DArray 281 281 +0.0% 1.00x
SortLargeExistentials 7811 7806 -0.1% 1.00x (?)
SortLettersInPlace 1144 1142 -0.2% 1.00x (?)
SortSortedStrings 837 843 +0.7% 0.99x (?)
SortStrings 1607 1613 +0.4% 1.00x (?)
SortStringsUnicode 7852 7544 -3.9% 1.04x
StackPromo 22406 22541 +0.6% 0.99x (?)
StaticArray 18 18 +0.0% 1.00x
StrComplexWalk 720 719 -0.1% 1.00x (?)
StrToInt 1929 1924 -0.3% 1.00x (?)
StringAdder 3508 3518 +0.3% 1.00x (?)
StringBuilder 1015 1030 +1.5% 0.99x
StringBuilderLong 926 930 +0.4% 1.00x (?)
StringEdits 117510 117617 +0.1% 1.00x (?)
StringEqualPointerComparison 333 333 +0.0% 1.00x
StringFromLongWholeSubstring 200 200 +0.0% 1.00x
StringFromLongWholeSubstringGeneric 22 22 +0.0% 1.00x
StringHasPrefix 16 16 +0.0% 1.00x
StringHasPrefixUnicode 15205 14668 -3.5% 1.04x (?)
StringHasSuffix 16 16 +0.0% 1.00x
StringHasSuffixUnicode 61686 61696 +0.0% 1.00x (?)
StringInterpolation 10782 10777 -0.0% 1.00x (?)
StringMatch 7587 7569 -0.2% 1.00x (?)
StringUTF16Builder 1882 1870 -0.6% 1.01x (?)
StringWalk 1288 1288 +0.0% 1.00x
StringWithCString 59545 60360 +1.4% 0.99x (?)
SubstringComparable 1539 1521 -1.2% 1.01x (?)
SubstringEqualString 1419 1420 +0.1% 1.00x (?)
SubstringEquatable 3404 3394 -0.3% 1.00x (?)
SubstringFromLongString 10 10 +0.0% 1.00x
SubstringFromLongStringGeneric 63 64 +1.6% 0.98x
SuffixAnyCollection 19 19 +0.0% 1.00x
SuffixAnyCollectionLazy 15358 15354 -0.0% 1.00x (?)
SuffixAnySeqCRangeIter 6304 6301 -0.0% 1.00x (?)
SuffixAnySeqCRangeIterLazy 6305 6301 -0.1% 1.00x (?)
SuffixAnySeqCntRange 10 10 +0.0% 1.00x
SuffixAnySeqCntRangeLazy 10 10 +0.0% 1.00x
SuffixAnySequence 8768 8704 -0.7% 1.01x (?)
SuffixAnySequenceLazy 8621 8619 -0.0% 1.00x (?)
SuffixArray 8 8 +0.0% 1.00x
SuffixArrayLazy 8 8 +0.0% 1.00x
SuffixCountableRange 11 11 +0.0% 1.00x
SuffixCountableRangeLazy 11 11 +0.0% 1.00x
SuffixSequence 5872 5864 -0.1% 1.00x (?)
SuffixSequenceLazy 5871 5865 -0.1% 1.00x (?)
SumUsingReduce 97 97 +0.0% 1.00x
SumUsingReduceInto 97 97 +0.0% 1.00x
SuperChars 80789 80470 -0.4% 1.00x (?)
TwoSum 987 975 -1.2% 1.01x (?)
TypeFlood 0 0 +0.0% 1.00x
UTF8Decode 257 257 +0.0% 1.00x
Walsh 373 374 +0.3% 1.00x (?)
XorLoop 347 347 +0.0% 1.00x
accessGlobal 3 3 +0.0% 1.00x
accessInMatSet 18 18 +0.0% 1.00x
accessIndependent 2 2 +0.0% 1.00x

Unoptimized (Onone)

Regression (2)
TEST OLD NEW DELTA SPEEDUP
SumUsingReduceInto 281089 315529 +12.3% 0.89x
ArrayAppendLatin1 73123 79537 +8.8% 0.92x
Improvement (11)
TEST OLD NEW DELTA SPEEDUP
DropFirstSequenceLazy 15818 13745 -13.1% 1.15x
PrefixSequence 12724 11071 -13.0% 1.15x
DropFirstSequence 16128 14072 -12.7% 1.15x
DropFirstAnySequenceLazy 17188 15122 -12.0% 1.14x
PrefixSequenceLazy 12533 11109 -11.4% 1.13x
PrefixAnySequenceLazy 14014 12426 -11.3% 1.13x
DropFirstAnySequence 16585 15002 -9.5% 1.11x
PrefixAnySequence 13664 12581 -7.9% 1.09x
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 108577 100558 -7.4% 1.08x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 7721 7297 -5.5% 1.06x (?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 75649 71923 -4.9% 1.05x (?)
No Changes (314)
TEST OLD NEW DELTA SPEEDUP
AngryPhonebook 5583 5591 +0.1% 1.00x (?)
AnyHashableWithAClass 83723 84198 +0.6% 0.99x
Array2D 607562 607601 +0.0% 1.00x (?)
ArrayAppend 4144 4142 -0.0% 1.00x (?)
ArrayAppendArrayOfInt 653 653 +0.0% 1.00x
ArrayAppendAscii 49715 50889 +2.4% 0.98x
ArrayAppendFromGeneric 656 656 +0.0% 1.00x
ArrayAppendGenericStructs 1304 1315 +0.8% 0.99x (?)
ArrayAppendLazyMap 314768 300695 -4.5% 1.05x (?)
ArrayAppendOptionals 1293 1288 -0.4% 1.00x (?)
ArrayAppendRepeatCol 228683 230482 +0.8% 0.99x (?)
ArrayAppendReserved 3939 3938 -0.0% 1.00x (?)
ArrayAppendSequence 119312 117789 -1.3% 1.01x (?)
ArrayAppendStrings 13633 13615 -0.1% 1.00x (?)
ArrayAppendToFromGeneric 656 655 -0.2% 1.00x
ArrayAppendToGeneric 656 656 +0.0% 1.00x
ArrayAppendUTF16 75098 75549 +0.6% 0.99x
ArrayInClass 6413 6415 +0.0% 1.00x (?)
ArrayLiteral 1743 1736 -0.4% 1.00x (?)
ArrayOfGenericPOD 1382 1382 +0.0% 1.00x
ArrayOfGenericRef 9730 9737 +0.1% 1.00x (?)
ArrayOfPOD 791 791 +0.0% 1.00x
ArrayOfRef 8874 8872 -0.0% 1.00x (?)
ArrayPlusEqualArrayOfInt 654 654 +0.0% 1.00x
ArrayPlusEqualFiveElementCollection 295897 294613 -0.4% 1.00x (?)
ArrayPlusEqualSingleElementCollection 292354 291776 -0.2% 1.00x (?)
ArrayPlusEqualThreeElements 10967 10870 -0.9% 1.01x (?)
ArraySubscript 4196 4200 +0.1% 1.00x (?)
ArrayValueProp 3525 3527 +0.1% 1.00x (?)
ArrayValueProp2 22750 22867 +0.5% 0.99x (?)
ArrayValueProp3 3948 3929 -0.5% 1.00x
ArrayValueProp4 3845 3844 -0.0% 1.00x (?)
BitCount 1741 1741 +0.0% 1.00x
ByteSwap 4106 4143 +0.9% 0.99x
CStringLongAscii 4799 4777 -0.5% 1.00x (?)
CStringLongNonAscii 2352 2335 -0.7% 1.01x (?)
CStringShortAscii 9245 9126 -1.3% 1.01x (?)
Calculator 1207 1205 -0.2% 1.00x (?)
CaptureProp 133079 129265 -2.9% 1.03x
CharIndexing_ascii_unicodeScalars 574357 571925 -0.4% 1.00x (?)
CharIndexing_ascii_unicodeScalars_Backwards 640872 639779 -0.2% 1.00x (?)
CharIndexing_chinese_unicodeScalars 430743 431332 +0.1% 1.00x (?)
CharIndexing_chinese_unicodeScalars_Backwards 485014 479914 -1.1% 1.01x (?)
CharIndexing_japanese_unicodeScalars 680815 681597 +0.1% 1.00x (?)
CharIndexing_japanese_unicodeScalars_Backwards 774754 762146 -1.6% 1.02x
CharIndexing_korean_unicodeScalars 553095 553434 +0.1% 1.00x (?)
CharIndexing_korean_unicodeScalars_Backwards 618773 616658 -0.3% 1.00x (?)
CharIndexing_punctuatedJapanese_unicodeScalars 97849 97768 -0.1% 1.00x (?)
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 109378 108891 -0.4% 1.00x (?)
CharIndexing_punctuated_unicodeScalars 124075 123753 -0.3% 1.00x (?)
CharIndexing_punctuated_unicodeScalars_Backwards 138480 137845 -0.5% 1.00x (?)
CharIndexing_russian_unicodeScalars 476868 474821 -0.4% 1.00x (?)
CharIndexing_russian_unicodeScalars_Backwards 530638 536006 +1.0% 0.99x (?)
CharIndexing_tweet_unicodeScalars 1134261 1134581 +0.0% 1.00x (?)
CharIndexing_tweet_unicodeScalars_Backwards 1271068 1256211 -1.2% 1.01x (?)
CharIndexing_utf16_unicodeScalars 651983 650733 -0.2% 1.00x (?)
CharIndexing_utf16_unicodeScalars_Backwards 694978 689085 -0.8% 1.01x (?)
CharIteration_ascii_unicodeScalars 238324 238469 +0.1% 1.00x (?)
CharIteration_ascii_unicodeScalars_Backwards 391770 389521 -0.6% 1.01x (?)
CharIteration_chinese_unicodeScalars 170957 171661 +0.4% 1.00x (?)
CharIteration_chinese_unicodeScalars_Backwards 292420 292204 -0.1% 1.00x (?)
CharIteration_japanese_unicodeScalars 271977 272181 +0.1% 1.00x (?)
CharIteration_japanese_unicodeScalars_Backwards 464634 464376 -0.1% 1.00x (?)
CharIteration_korean_unicodeScalars 231092 230855 -0.1% 1.00x (?)
CharIteration_korean_unicodeScalars_Backwards 377029 377081 +0.0% 1.00x (?)
CharIteration_punctuatedJapanese_unicodeScalars 40022 40080 +0.1% 1.00x
CharIteration_punctuatedJapanese_unicodeScalars_Backwards 67140 67119 -0.0% 1.00x (?)
CharIteration_punctuated_unicodeScalars 50935 50952 +0.0% 1.00x (?)
CharIteration_punctuated_unicodeScalars_Backwards 85109 84980 -0.2% 1.00x (?)
CharIteration_russian_unicodeScalars 190135 190479 +0.2% 1.00x
CharIteration_russian_unicodeScalars_Backwards 323988 326327 +0.7% 0.99x (?)
CharIteration_tweet_unicodeScalars 447625 448241 +0.1% 1.00x (?)
CharIteration_tweet_unicodeScalars_Backwards 773484 772761 -0.1% 1.00x (?)
CharIteration_utf16_unicodeScalars 243824 243857 +0.0% 1.00x (?)
CharIteration_utf16_unicodeScalars_Backwards 473921 476688 +0.6% 0.99x (?)
CharacterLiteralsLarge 6185 6181 -0.1% 1.00x (?)
CharacterLiteralsSmall 653 652 -0.2% 1.00x
Chars 66754 66767 +0.0% 1.00x (?)
ClassArrayGetter 989 989 +0.0% 1.00x
DeadArray 115939 114357 -1.4% 1.01x (?)
Dictionary 3461 3478 +0.5% 1.00x (?)
Dictionary2 3425 3403 -0.6% 1.01x (?)
Dictionary2OfObjects 6063 6071 +0.1% 1.00x (?)
Dictionary3 1307 1306 -0.1% 1.00x (?)
Dictionary3OfObjects 2320 2332 +0.5% 0.99x (?)
DictionaryBridge 2627 2656 +1.1% 0.99x (?)
DictionaryGroup 5349 5297 -1.0% 1.01x (?)
DictionaryGroupOfObjects 8796 8806 +0.1% 1.00x (?)
DictionaryLiteral 8223 8212 -0.1% 1.00x (?)
DictionaryOfObjects 7052 7026 -0.4% 1.00x (?)
DictionaryRemove 21550 21602 +0.2% 1.00x
DictionaryRemoveOfObjects 59790 59931 +0.2% 1.00x (?)
DictionarySwap 5249 5272 +0.4% 1.00x (?)
DictionarySwapOfObjects 23250 23315 +0.3% 1.00x (?)
DropFirstAnyCollection 21083 20679 -1.9% 1.02x (?)
DropFirstAnyCollectionLazy 151997 151947 -0.0% 1.00x (?)
DropFirstAnySeqCRangeIter 31231 30116 -3.6% 1.04x
DropFirstAnySeqCRangeIterLazy 31248 30820 -1.4% 1.01x (?)
DropFirstAnySeqCntRange 21030 20639 -1.9% 1.02x
DropFirstAnySeqCntRangeLazy 20638 20571 -0.3% 1.00x
DropFirstArray 10607 10359 -2.3% 1.02x (?)
DropFirstArrayLazy 52712 52805 +0.2% 1.00x (?)
DropFirstCountableRange 340 340 +0.0% 1.00x
DropFirstCountableRangeLazy 38495 38903 +1.1% 0.99x (?)
DropLastAnyCollection 7042 6909 -1.9% 1.02x
DropLastAnyCollectionLazy 50848 50556 -0.6% 1.01x (?)
DropLastAnySeqCRangeIter 47896 47439 -1.0% 1.01x (?)
DropLastAnySeqCRangeIterLazy 47426 47014 -0.9% 1.01x (?)
DropLastAnySeqCntRange 7049 6942 -1.5% 1.02x
DropLastAnySeqCntRangeLazy 6935 6855 -1.2% 1.01x
DropLastAnySequence 32679 32666 -0.0% 1.00x (?)
DropLastAnySequenceLazy 33439 33621 +0.5% 0.99x (?)
DropLastArray 3455 3456 +0.0% 1.00x (?)
DropLastArrayLazy 17527 17563 +0.2% 1.00x (?)
DropLastCountableRange 118 118 +0.0% 1.00x
DropLastCountableRangeLazy 12848 12964 +0.9% 0.99x
DropLastSequence 32749 32728 -0.1% 1.00x (?)
DropLastSequenceLazy 32074 32198 +0.4% 1.00x (?)
DropWhileAnyCollection 26734 26382 -1.3% 1.01x
DropWhileAnyCollectionLazy 29812 29459 -1.2% 1.01x
DropWhileAnySeqCRangeIter 32958 32623 -1.0% 1.01x (?)
DropWhileAnySeqCRangeIterLazy 30516 29970 -1.8% 1.02x (?)
DropWhileAnySeqCntRange 26662 26340 -1.2% 1.01x
DropWhileAnySeqCntRangeLazy 30153 29742 -1.4% 1.01x
DropWhileAnySequence 17091 17010 -0.5% 1.00x
DropWhileAnySequenceLazy 15571 15436 -0.9% 1.01x
DropWhileArray 14152 14129 -0.2% 1.00x (?)
DropWhileArrayLazy 24959 24895 -0.3% 1.00x (?)
DropWhileCountableRange 6032 6036 +0.1% 1.00x (?)
DropWhileCountableRangeLazy 28694 28291 -1.4% 1.01x (?)
DropWhileSequence 16272 16089 -1.1% 1.01x
DropWhileSequenceLazy 14248 14192 -0.4% 1.00x
EqualStringSubstring 662 662 +0.0% 1.00x
EqualSubstringString 662 662 +0.0% 1.00x
EqualSubstringSubstring 771 770 -0.1% 1.00x (?)
EqualSubstringSubstringGenericEquatable 420 421 +0.2% 1.00x
ErrorHandling 7724 7761 +0.5% 1.00x (?)
FilterEvenUsingReduce 4900 4893 -0.1% 1.00x
FilterEvenUsingReduceInto 3094 3099 +0.2% 1.00x
FrequenciesUsingReduce 16298 16313 +0.1% 1.00x (?)
FrequenciesUsingReduceInto 9396 9426 +0.3% 1.00x (?)
Hanoi 18615 18537 -0.4% 1.00x
HashTest 18115 18173 +0.3% 1.00x (?)
Histogram 9682 9688 +0.1% 1.00x (?)
Integrate 721 721 +0.0% 1.00x
IterateData 12421 12806 +3.1% 0.97x
Join 1741 1742 +0.1% 1.00x (?)
LazilyFilteredArrays 2038359 2038430 +0.0% 1.00x (?)
LazilyFilteredRange 759296 745952 -1.8% 1.02x
LessSubstringSubstring 775 776 +0.1% 1.00x
LessSubstringSubstringGenericComparable 440 440 +0.0% 1.00x
LinkedList 40413 40410 -0.0% 1.00x (?)
MapReduce 44266 44249 -0.0% 1.00x (?)
MapReduceAnyCollection 44322 44316 -0.0% 1.00x (?)
MapReduceAnyCollectionShort 57082 57182 +0.2% 1.00x (?)
MapReduceClass 49605 49575 -0.1% 1.00x
MapReduceClassShort 61006 61085 +0.1% 1.00x (?)
MapReduceLazyCollection 43697 43638 -0.1% 1.00x (?)
MapReduceLazyCollectionShort 55268 55356 +0.2% 1.00x (?)
MapReduceLazySequence 31516 31679 +0.5% 0.99x (?)
MapReduceSequence 50286 50383 +0.2% 1.00x (?)
MapReduceShort 56435 56636 +0.4% 1.00x (?)
MapReduceShortString 316 319 +0.9% 0.99x (?)
MapReduceString 3203 3192 -0.3% 1.00x (?)
Memset 44797 44794 -0.0% 1.00x (?)
MonteCarloE 147485 147324 -0.1% 1.00x (?)
MonteCarloPi 52597 52603 +0.0% 1.00x (?)
NSDictionaryCastToSwift 6579 6578 -0.0% 1.00x (?)
NSError 702 724 +3.1% 0.97x (?)
NSStringConversion 402 402 +0.0% 1.00x
NopDeinit 179057 179095 +0.0% 1.00x (?)
ObjectAllocation 1651 1649 -0.1% 1.00x (?)
ObjectiveCBridgeFromNSArrayAnyObject 24341 24536 +0.8% 0.99x (?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 6695 6722 +0.4% 1.00x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 39639 40405 +1.9% 0.98x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 34078 33995 -0.2% 1.00x (?)
ObjectiveCBridgeFromNSDictionaryAnyObject 122146 121898 -0.2% 1.00x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 98728 97715 -1.0% 1.01x (?)
ObjectiveCBridgeFromNSSetAnyObject 68685 68677 -0.0% 1.00x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 7581 7433 -2.0% 1.02x
ObjectiveCBridgeFromNSSetAnyObjectToString 73309 72922 -0.5% 1.01x (?)
ObjectiveCBridgeFromNSString 3816 3818 +0.1% 1.00x (?)
ObjectiveCBridgeFromNSStringForced 2203 2208 +0.2% 1.00x
ObjectiveCBridgeStubDataAppend 4012 4060 +1.2% 0.99x (?)
ObjectiveCBridgeStubDateAccess 1061 1061 +0.0% 1.00x
ObjectiveCBridgeStubDateMutation 515 515 +0.0% 1.00x
ObjectiveCBridgeStubFromArrayOfNSString 24826 24929 +0.4% 1.00x (?)
ObjectiveCBridgeStubFromNSDate 3885 3859 -0.7% 1.01x (?)
ObjectiveCBridgeStubFromNSDateRef 4659 4650 -0.2% 1.00x (?)
ObjectiveCBridgeStubFromNSString 577 587 +1.7% 0.98x
ObjectiveCBridgeStubFromNSStringRef 182 189 +3.8% 0.96x
ObjectiveCBridgeStubNSDataAppend 2789 2774 -0.5% 1.01x (?)
ObjectiveCBridgeStubNSDateMutationRef 16015 15478 -3.4% 1.03x (?)
ObjectiveCBridgeStubNSDateRefAccess 1224 1228 +0.3% 1.00x (?)
ObjectiveCBridgeStubToArrayOfNSString 28884 28983 +0.3% 1.00x (?)
ObjectiveCBridgeStubToNSDate 15071 14799 -1.8% 1.02x (?)
ObjectiveCBridgeStubToNSDateRef 3300 3295 -0.2% 1.00x (?)
ObjectiveCBridgeStubToNSString 1565 1564 -0.1% 1.00x (?)
ObjectiveCBridgeStubToNSStringRef 155 156 +0.6% 0.99x (?)
ObjectiveCBridgeStubURLAppendPath 224195 227442 +1.4% 0.99x
ObjectiveCBridgeStubURLAppendPathRef 225606 228208 +1.2% 0.99x (?)
ObjectiveCBridgeToNSArray 28716 28713 -0.0% 1.00x (?)
ObjectiveCBridgeToNSDictionary 45427 45371 -0.1% 1.00x (?)
ObjectiveCBridgeToNSSet 38945 39473 +1.4% 0.99x (?)
ObjectiveCBridgeToNSString 1301 1303 +0.2% 1.00x (?)
ObserverClosure 7415 7418 +0.0% 1.00x (?)
ObserverForwarderStruct 5501 5524 +0.4% 1.00x
ObserverPartiallyAppliedMethod 8913 8924 +0.1% 1.00x (?)
ObserverUnappliedMethod 9433 9433 +0.0% 1.00x
OpenClose 392 394 +0.5% 0.99x
Phonebook 22047 22102 +0.2% 1.00x
PolymorphicCalls 5350 5333 -0.3% 1.00x (?)
PopFrontArray 9930 9910 -0.2% 1.00x (?)
PopFrontArrayGeneric 8940 8851 -1.0% 1.01x (?)
PopFrontUnsafePointer 96971 96989 +0.0% 1.00x (?)
PrefixAnyCollection 21251 20921 -1.6% 1.02x
PrefixAnyCollectionLazy 153836 153429 -0.3% 1.00x (?)
PrefixAnySeqCRangeIter 24840 24001 -3.4% 1.03x
PrefixAnySeqCRangeIterLazy 24931 24387 -2.2% 1.02x
PrefixAnySeqCntRange 21042 20670 -1.8% 1.02x (?)
PrefixAnySeqCntRangeLazy 20671 20577 -0.5% 1.00x
PrefixArray 10452 10416 -0.3% 1.00x (?)
PrefixArrayLazy 52649 52865 +0.4% 1.00x (?)
PrefixCountableRange 336 336 +0.0% 1.00x
PrefixCountableRangeLazy 38556 39007 +1.2% 0.99x (?)
PrefixWhileAnyCollection 38110 37808 -0.8% 1.01x
PrefixWhileAnyCollectionLazy 25866 25555 -1.2% 1.01x (?)
PrefixWhileAnySeqCRangeIter 47191 46587 -1.3% 1.01x (?)
PrefixWhileAnySeqCRangeIterLazy 25710 25408 -1.2% 1.01x
PrefixWhileAnySeqCntRange 37785 37399 -1.0% 1.01x (?)
PrefixWhileAnySeqCntRangeLazy 26029 25738 -1.1% 1.01x
PrefixWhileAnySequence 35703 35344 -1.0% 1.01x (?)
PrefixWhileAnySequenceLazy 15351 15312 -0.3% 1.00x (?)
PrefixWhileArray 21447 21347 -0.5% 1.00x (?)
PrefixWhileArrayLazy 23786 24183 +1.7% 0.98x (?)
PrefixWhileCountableRange 17275 17314 +0.2% 1.00x (?)
PrefixWhileCountableRangeLazy 24786 24515 -1.1% 1.01x (?)
PrefixWhileSequence 34055 34765 +2.1% 0.98x (?)
PrefixWhileSequenceLazy 14345 14533 +1.3% 0.99x
Prims 10507 10489 -0.2% 1.00x (?)
ProtocolDispatch 6940 6939 -0.0% 1.00x (?)
ProtocolDispatch2 490 490 +0.0% 1.00x
RC4 19490 19123 -1.9% 1.02x
RGBHistogram 35882 35731 -0.4% 1.00x (?)
RGBHistogramOfObjects 109817 109628 -0.2% 1.00x (?)
RangeAssignment 5784 5767 -0.3% 1.00x (?)
RecursiveOwnedParameter 11199 11188 -0.1% 1.00x
ReversedArray 53319 53110 -0.4% 1.00x
ReversedBidirectional 89684 89437 -0.3% 1.00x (?)
ReversedDictionary 35288 35384 +0.3% 1.00x
SetExclusiveOr 22263 22115 -0.7% 1.01x (?)
SetExclusiveOr_OfObjects 48316 48414 +0.2% 1.00x (?)
SetIntersect 11159 11140 -0.2% 1.00x (?)
SetIntersect_OfObjects 12533 12578 +0.4% 1.00x
SetIsSubsetOf 1683 1685 +0.1% 1.00x
SetIsSubsetOf_OfObjects 1593 1585 -0.5% 1.01x
SetUnion 12621 12386 -1.9% 1.02x (?)
SetUnion_OfObjects 33828 33774 -0.2% 1.00x (?)
SevenBoom 1607 1596 -0.7% 1.01x (?)
Sim2DArray 44165 44165 +0.0% 1.00x
SortLargeExistentials 18058 17945 -0.6% 1.01x
SortLettersInPlace 3147 3148 +0.0% 1.00x (?)
SortSortedStrings 1423 1433 +0.7% 0.99x (?)
SortStrings 2491 2519 +1.1% 0.99x (?)
SortStringsUnicode 8798 8906 +1.2% 0.99x
StackPromo 100527 100549 +0.0% 1.00x (?)
StaticArray 4590 4568 -0.5% 1.00x
StrComplexWalk 6775 6755 -0.3% 1.00x (?)
StrToInt 116444 116632 +0.2% 1.00x (?)
StringAdder 3756 3792 +1.0% 0.99x
StringBuilder 8428 8689 +3.1% 0.97x
StringBuilderLong 1112 1111 -0.1% 1.00x (?)
StringEdits 416928 414677 -0.5% 1.01x (?)
StringEqualPointerComparison 2616 2628 +0.5% 1.00x
StringFromLongWholeSubstring 215 216 +0.5% 1.00x
StringFromLongWholeSubstringGeneric 207 208 +0.5% 1.00x (?)
StringHasPrefix 1746 1697 -2.8% 1.03x
StringHasPrefixUnicode 16645 16370 -1.7% 1.02x
StringHasSuffix 1870 1889 +1.0% 0.99x (?)
StringHasSuffixUnicode 63415 63444 +0.0% 1.00x (?)
StringInterpolation 13856 13921 +0.5% 1.00x (?)
StringMatch 34633 34568 -0.2% 1.00x (?)
StringUTF16Builder 9232 9249 +0.2% 1.00x (?)
StringWalk 12793 12832 +0.3% 1.00x
StringWithCString 58516 58530 +0.0% 1.00x (?)
SubstringComparable 4875 4897 +0.5% 1.00x
SubstringEqualString 6572 6567 -0.1% 1.00x (?)
SubstringEquatable 9428 9489 +0.6% 0.99x
SubstringFromLongString 12 12 +0.0% 1.00x
SubstringFromLongStringGeneric 114 115 +0.9% 0.99x
SuffixAnyCollection 7078 6990 -1.2% 1.01x (?)
SuffixAnyCollectionLazy 51121 50799 -0.6% 1.01x (?)
SuffixAnySeqCRangeIter 45010 44671 -0.8% 1.01x (?)
SuffixAnySeqCRangeIterLazy 44568 44220 -0.8% 1.01x (?)
SuffixAnySeqCntRange 7043 6920 -1.7% 1.02x
SuffixAnySeqCntRangeLazy 6952 6859 -1.3% 1.01x (?)
SuffixAnySequence 30121 30151 +0.1% 1.00x (?)
SuffixAnySequenceLazy 30389 30366 -0.1% 1.00x (?)
SuffixArray 3481 3456 -0.7% 1.01x (?)
SuffixArrayLazy 17567 17599 +0.2% 1.00x (?)
SuffixCountableRange 116 116 +0.0% 1.00x
SuffixCountableRangeLazy 12849 13020 +1.3% 0.99x (?)
SuffixSequence 29749 29716 -0.1% 1.00x
SuffixSequenceLazy 29671 29649 -0.1% 1.00x (?)
SumUsingReduce 287880 289105 +0.4% 1.00x (?)
SuperChars 220909 220808 -0.0% 1.00x (?)
TwoSum 4257 4242 -0.4% 1.00x (?)
TypeFlood 161 165 +2.5% 0.98x (?)
UTF8Decode 49953 49897 -0.1% 1.00x
Walsh 12154 12162 +0.1% 1.00x (?)
XorLoop 24011 24011 +0.0% 1.00x
accessGlobal 184 184 +0.0% 1.00x
accessInMatSet 324 325 +0.3% 1.00x
accessIndependent 124 124 +0.0% 1.00x
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

@atrick atrick requested a review from eeckstein August 3, 2017 16:28
// copy_addr [initialization] and destroy_addr.
TempRValue rvalue;
rvalue.copy = copyInst;
for (auto *useOper : copyDest->getUses()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Checking if the user is in the same block as the copy_addr here might save some compile time.
Consider a very large basic block with lots of copy_addrs where this is not the case. You would iterate over all instructions of the basic block for all copy_addrs (which is quadratic).

@@ -1291,6 +1410,11 @@ class CopyForwardingPass : public SILFunctionTransform
}
}

// Eliminate short-lived temporaries.
for (auto &rvalue : RValueCopies) {
removeTempRValue(rvalue);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it always guaranteed that the instructions which are deleted here are not referenced in the subsequent code?
E.g. if there are 2 copy_addrs referencing the same alloc_stack

Maybe it's saver that removeTempRValue just does a replaceAllUsesWith and let the alloc/dealloc/destroy/copy_addr be deleted by a subsequent cleanup pass.
This would also simplify the code a bit, because you would not need the TempRValue struct.

rvalue.dealloc = cast<DeallocStackInst>(user);
continue;
}
if (user->mayWriteToMemory())
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this check is needed here, but it does not harm.
If all uses have to be in the same block you would catch wring instructions in the code below.

/// writes to memory. This is sufficient to prove the copy is unnecesary.
///
/// Return the single dealloc_stack corresponding to the temporary storage for
/// teh copy's destination. Return null if the copy does not initialize an
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: teh

@atrick
Copy link
Contributor Author

atrick commented Aug 3, 2017

Removing these obvious copies causes as many new regressions as it resolves. We should wait until we understand what really needs to be fixed here before merging this.

@atrick atrick changed the title Add a simple peephole optimization to CopyForwarding. ⚠️Add a simple peephole optimization to CopyForwarding. Aug 3, 2017
atrick added 2 commits August 3, 2017 16:46
…ization.

This is a much more aggressive attempt at removing temporary "rvalues" inside
the CopyForwarding pass. It is now handles basic switch CFGs and does some
memory disambiguation.

This is still insufficient to handle the case that caused the worst benchmark
regressions, which are caused by UnfoldSequence. The problem is, that executes
an escaping closure during the temporary rvalue's lifetime. The only way around
that is to fully analyze both sides of the copy down through all uses to prove
they are completely nonescaping.

Note, the original intention of the CopyForwarding pass was a very quick Onone
peephole that did not require escape analysis or alias analysis.
This version successfully optimizes UnfoldSequence, which is the holy grail.

Unfortunately, there's a problem building the stdlib which seems to be a
use-after-free. Note that we need to remove copied from CopiedDefs when we
eliminate them, but it doesn't seem to be working properly.

Once that's fixed, we need to run the benchmarks.
@atrick atrick changed the title ⚠️Add a simple peephole optimization to CopyForwarding. ⚠️Add a new TempRValue optimization to the CopyForwarding pass. Aug 4, 2017
@gottesmm
Copy link
Contributor

gottesmm commented Aug 4, 2017

Thanks Andy!

@gottesmm
Copy link
Contributor

gottesmm commented Aug 4, 2017

I can reproduce the crash. I am investigating.

@gottesmm
Copy link
Contributor

gottesmm commented Aug 4, 2017

Copy Forwarding in Func _T0s11DoubleWidthVyxGs27ExpressibleByIntegerLiteralss05FixedbE0Rzs10Collection5WordsRpzsAF9Magnitude_AGRPzlsADPx0eF4TypeQz07integerF0_tcfCTW
Checking read only temp  copy_addr %1 to [initialization] %4 : $*DoubleWidth<τ_0_0> // id: %5
Eliminating temp RValue copy  copy_addr %1 to [initialization] %4 : $*DoubleWidth<τ_0_0> // id: %5
Analyzing copies of Def:   %1 = argument of bb0 : $*DoubleWidth<τ_0_0>    // users: %4, %6
  Forwarding Copy:  copy_addr %1 to [initialization] %3 : $*DoubleWidth<τ_0_0> // id: %4
Analyzing copies of Def:   %1 = argument of bb0 : $*DoubleWidth<τ_0_0>    // users: %4, %5
Analyzing copies of Def:   Process 89036 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)

@gottesmm
Copy link
Contributor

gottesmm commented Aug 4, 2017

I think this is the test case that is causing the failure:


sil_stage canonical

import Builtin

sil @tmp : $@convention(thin) (@in Builtin.NativeObject, @thick Builtin.NativeObject.Type) -> @out Builtin.NativeObject {
// %0                                             // user: %8
// %1                                             // users: %9, %5
bb0(%0 : @trivial $*Builtin.NativeObject, %1 : @trivial $*Builtin.NativeObject, %2 : @trivial $@thick Builtin.NativeObject.Type):
  %3 = alloc_stack $Builtin.NativeObject           // users: %6, %11, %10, %8
  %4 = alloc_stack $Builtin.NativeObject           // users: %7, %6, %5
  copy_addr %1 to [initialization] %4 : $*Builtin.NativeObject // id: %5
  copy_addr [take] %4 to [initialization] %3 : $*Builtin.NativeObject // id: %6
  dealloc_stack %4 : $*Builtin.NativeObject        // id: %7
  copy_addr %3 to [initialization] %0 : $*Builtin.NativeObject // id: %8
  destroy_addr %1 : $*Builtin.NativeObject         // id: %9
  destroy_addr %3 : $*Builtin.NativeObject         // id: %10
  dealloc_stack %3 : $*Builtin.NativeObject        // id: %11
  %12 = tuple ()
  %13 = tuple ()                                  // user: %14
  return %13 : $()                                // id: %14
}

It is something related to the CopiedDef list having a dangling pointer in it. I need to spend a little more time with this.

@gottesmm
Copy link
Contributor

gottesmm commented Aug 4, 2017

I found the problem. The problem is that CopiedDefs is removing the copy instruction instead of the copyDest. When I fix that, I hit a different issue later in the pipeline. I am looking at it now.

@gottesmm
Copy link
Contributor

gottesmm commented Aug 4, 2017

My patch:

--- a/lib/SILOptimizer/Transforms/CopyForwarding.cpp
+++ b/lib/SILOptimizer/Transforms/CopyForwarding.cpp
@@ -1474,12 +1474,12 @@ void TempRValueOptimization::removeTemp() {
   for (auto *dealloc : deallocInsts)
     dealloc->eraseFromParent();
 
+  // This def may have been identified as a candidate for further attempts to
+  // perform copy forwarding.
+  CopiedDefs.remove(copyDest);
   copyDest->replaceAllUsesWith(copyInst->getSrc());
   copyDest->eraseFromParent();
 
-  // This copy might have been identified as a candidate for normal copy
-  // propagation.
-  CopiedDefs.remove(copyInst);
   copyInst->eraseFromParent();
 }

@gottesmm
Copy link
Contributor

gottesmm commented Aug 4, 2017

@eeckstein I am going to close this and open one with my own branch. That way I can push things. I will reference this PR.

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