Skip to content
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

[WIP] Accommodate exceptional values for array comparison #12503

Closed
wants to merge 1 commit into from
Closed

[WIP] Accommodate exceptional values for array comparison #12503

wants to merge 1 commit into from

Conversation

xwu
Copy link
Collaborator

@xwu xwu commented Oct 19, 2017

Array.== tests for referential equality and returns true if the underlying buffer is shared between two instances. This provides for unexpected behavior in the case of comparisons involving floating-point NaN. Since Double.nan != Double.nan, the result of a comparison of arrays that contain NaN would depend on whether the underlying buffer is shared.

var a: [Double] = [1, .nan]
var b: [Double] = [1, .nan]

var copy = a

a == b // false
a == copy // true

Whether Equatable ought to accommodate IEEE-mandated behavior of floating-point NaN is potentially a design topic to be revisited, but the inconsistent behavior here requires a fix in order to permit predictable behavior in the face of the current, deliberate implementation of FloatingPoint.==.

In documentation for Comparable, a note states:

A conforming type may contain a subset of values which are treated as exceptional—that is, values that are outside the domain of meaningful arguments for the purposes of the Comparable protocol. For example, the special “not a number” value for floating-point types (FloatingPoint.nan) compares as neither less than, greater than, nor equal to any normal floating-point value. Exceptional values need not take part in the strict total order.

This PR incorporates this particular exception into an underscored static protocol requirement of Equatable named _containsExceptionalValues. A default implementation returns false and floating-point types return true. Array.== then consults this static requirement prior to relying on referential equality.

Resolves SR-6181.

@xwu
Copy link
Collaborator Author

xwu commented Oct 19, 2017

@airspeedswift I know you don't like Double.nan != Double.nan, but there's good arguments to be made for preserving the behavior of floating-point == and none for the inconsistent results from Array<Double>. This fix is maximally performance-preserving, affecting only the necessary case where a floating point array is compared to itself and does not have sign-of-zero mismatches.

/cc @moiseev @ole

@moiseev
Copy link
Contributor

moiseev commented Oct 19, 2017

What about the Decimal in Foundation? Does the same logic apply there?

@moiseev
Copy link
Contributor

moiseev commented Oct 19, 2017

@swift-ci Please smoke test

@moiseev
Copy link
Contributor

moiseev commented Oct 19, 2017

@swift-ci Please benchmark

@xwu
Copy link
Collaborator Author

xwu commented Oct 19, 2017

@moiseev Yes, applies to Decimal because it too has NaN. Should work out of the box.

@swift-ci
Copy link
Collaborator

Build comment file:

Optimized (O)

Regression (12)
TEST OLD NEW DELTA SPEEDUP
Sim2DArray 329 432 +31.3% 0.76x
DropFirstArray 29 35 +20.7% 0.83x
RangeIterationSigned 128 147 +14.8% 0.87x (?)
LazilyFilteredArrayContains 17283 19596 +13.4% 0.88x
MapReduce 344 388 +12.8% 0.89x
MapReduceLazyCollection 11 12 +9.1% 0.92x (?)
ObjectiveCBridgeStubURLAppendPath 200234 218393 +9.1% 0.92x (?)
MapReduceAnyCollection 378 411 +8.7% 0.92x (?)
ClassArrayGetter 12 13 +8.3% 0.92x
NopDeinit 20198 21776 +7.8% 0.93x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 4808 5111 +6.3% 0.94x (?)
MapReduceString 93 98 +5.4% 0.95x (?)
Improvement (20)
TEST OLD NEW DELTA SPEEDUP
ObjectiveCBridgeStubNSDateRefAccess 350 313 -10.6% 1.12x
PopFrontUnsafePointer 5879 5275 -10.3% 1.11x (?)
AnyHashableWithAClass 72205 65404 -9.4% 1.10x (?)
AngryPhonebook 3059 2776 -9.3% 1.10x
ArrayAppendLatin1 44452 40402 -9.1% 1.10x (?)
ArrayAppendSequence 1027 943 -8.2% 1.09x (?)
ArrayInClass 68 63 -7.4% 1.08x (?)
ArrayAppendLazyMap 966 895 -7.3% 1.08x
ArrayPlusEqualFiveElementCollection 4613 4282 -7.2% 1.08x (?)
BitCount 142 132 -7.0% 1.08x
ArrayAppendStrings 15213 14151 -7.0% 1.08x
ArrayAppendFromGeneric 604 564 -6.6% 1.07x (?)
ArrayAppendUTF16 43606 40907 -6.2% 1.07x (?)
ArrayAppendOptionals 1207 1135 -6.0% 1.06x
CStringLongAscii 4911 4637 -5.6% 1.06x (?)
ArrayAppendRepeatCol 994 942 -5.2% 1.06x (?)
ByteSwap 116 110 -5.2% 1.05x
Array2D 1982 1881 -5.1% 1.05x (?)
ArrayAppendGenericStructs 1194 1135 -4.9% 1.05x
PrefixAnySequence 5381 5121 -4.8% 1.05x (?)
No Changes (302)
TEST OLD NEW DELTA SPEEDUP
ArrayAppend 1050 1012 -3.6% 1.04x (?)
ArrayAppendArrayOfInt 589 564 -4.2% 1.04x
ArrayAppendAscii 20283 19773 -2.5% 1.03x (?)
ArrayAppendReserved 821 793 -3.4% 1.04x (?)
ArrayAppendToFromGeneric 592 564 -4.7% 1.05x (?)
ArrayAppendToGeneric 592 565 -4.6% 1.05x
ArrayLiteral 0 0 +0.0% 1.00x
ArrayOfGenericPOD 211 207 -1.9% 1.02x (?)
ArrayOfGenericRef 3877 3741 -3.5% 1.04x (?)
ArrayOfPOD 157 156 -0.6% 1.01x (?)
ArrayOfRef 3805 3677 -3.4% 1.03x (?)
ArrayPlusEqualArrayOfInt 567 564 -0.5% 1.01x (?)
ArrayPlusEqualSingleElementCollection 1024 1009 -1.5% 1.01x (?)
ArrayPlusEqualThreeElements 1576 1592 +1.0% 0.99x (?)
ArraySetElement 431 411 -4.6% 1.05x (?)
ArraySubscript 1433 1406 -1.9% 1.02x (?)
ArrayValueProp 5 5 +0.0% 1.00x
ArrayValueProp2 5 5 +0.0% 1.00x
ArrayValueProp3 5 5 +0.0% 1.00x
ArrayValueProp4 5 5 +0.0% 1.00x
CStringLongNonAscii 2250 2201 -2.2% 1.02x (?)
CStringShortAscii 4731 4565 -3.5% 1.04x (?)
Calculator 35 36 +2.9% 0.97x (?)
CaptureProp 4772 4578 -4.1% 1.04x (?)
CharIndexing_ascii_unicodeScalars 13193 12716 -3.6% 1.04x (?)
CharIndexing_ascii_unicodeScalars_Backwards 10868 10939 +0.7% 0.99x (?)
CharIndexing_chinese_unicodeScalars 10069 9903 -1.6% 1.02x (?)
CharIndexing_chinese_unicodeScalars_Backwards 8228 8132 -1.2% 1.01x (?)
CharIndexing_japanese_unicodeScalars 15911 15607 -1.9% 1.02x (?)
CharIndexing_japanese_unicodeScalars_Backwards 12934 12713 -1.7% 1.02x (?)
CharIndexing_korean_unicodeScalars 12728 12532 -1.5% 1.02x (?)
CharIndexing_korean_unicodeScalars_Backwards 10554 10498 -0.5% 1.01x (?)
CharIndexing_punctuatedJapanese_unicodeScalars 2407 2441 +1.4% 0.99x (?)
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 2024 2025 +0.0% 1.00x (?)
CharIndexing_punctuated_unicodeScalars 3012 3008 -0.1% 1.00x (?)
CharIndexing_punctuated_unicodeScalars_Backwards 2499 2533 +1.4% 0.99x (?)
CharIndexing_russian_unicodeScalars 10785 10993 +1.9% 0.98x (?)
CharIndexing_russian_unicodeScalars_Backwards 8999 8999 +0.0% 1.00x
CharIndexing_tweet_unicodeScalars 25896 25698 -0.8% 1.01x (?)
CharIndexing_tweet_unicodeScalars_Backwards 21445 21531 +0.4% 1.00x (?)
CharIndexing_utf16_unicodeScalars 76952 77185 +0.3% 1.00x (?)
CharIndexing_utf16_unicodeScalars_Backwards 57786 57137 -1.1% 1.01x (?)
CharIteration_ascii_unicodeScalars 14945 14903 -0.3% 1.00x (?)
CharIteration_ascii_unicodeScalars_Backwards 15862 15692 -1.1% 1.01x (?)
CharIteration_chinese_unicodeScalars 11227 11510 +2.5% 0.98x (?)
CharIteration_chinese_unicodeScalars_Backwards 12081 12188 +0.9% 0.99x (?)
CharIteration_japanese_unicodeScalars 17883 18161 +1.6% 0.98x (?)
CharIteration_japanese_unicodeScalars_Backwards 18931 19277 +1.8% 0.98x (?)
CharIteration_korean_unicodeScalars 14439 15156 +5.0% 0.95x (?)
CharIteration_korean_unicodeScalars_Backwards 15866 15341 -3.3% 1.03x (?)
CharIteration_punctuatedJapanese_unicodeScalars 2726 2752 +1.0% 0.99x (?)
CharIteration_punctuatedJapanese_unicodeScalars_Backwards 2879 2837 -1.5% 1.01x (?)
CharIteration_punctuated_unicodeScalars 3429 3445 +0.5% 1.00x (?)
CharIteration_punctuated_unicodeScalars_Backwards 3577 3577 +0.0% 1.00x
CharIteration_russian_unicodeScalars 12454 12936 +3.9% 0.96x (?)
CharIteration_russian_unicodeScalars_Backwards 13393 13139 -1.9% 1.02x (?)
CharIteration_tweet_unicodeScalars 29576 30043 +1.6% 0.98x (?)
CharIteration_tweet_unicodeScalars_Backwards 31503 31022 -1.5% 1.02x (?)
CharIteration_utf16_unicodeScalars 74872 74886 +0.0% 1.00x (?)
CharIteration_utf16_unicodeScalars_Backwards 94082 93367 -0.8% 1.01x (?)
CharacterLiteralsLarge 5607 5791 +3.3% 0.97x (?)
CharacterLiteralsSmall 382 392 +2.6% 0.97x (?)
Chars 562 591 +5.2% 0.95x (?)
DeadArray 178 179 +0.6% 0.99x (?)
Dictionary 540 556 +3.0% 0.97x (?)
Dictionary2 1775 1783 +0.5% 1.00x (?)
Dictionary2OfObjects 3103 3186 +2.7% 0.97x (?)
Dictionary3 442 443 +0.2% 1.00x (?)
Dictionary3OfObjects 789 790 +0.1% 1.00x (?)
DictionaryBridge 2384 2409 +1.0% 0.99x (?)
DictionaryGroup 258 259 +0.4% 1.00x (?)
DictionaryGroupOfObjects 1728 1749 +1.2% 0.99x (?)
DictionaryLiteral 1407 1437 +2.1% 0.98x (?)
DictionaryOfObjects 2127 2146 +0.9% 0.99x (?)
DictionaryRemove 2408 2442 +1.4% 0.99x (?)
DictionaryRemoveOfObjects 21476 21500 +0.1% 1.00x (?)
DictionarySwap 403 405 +0.5% 1.00x (?)
DictionarySwapOfObjects 6998 7002 +0.1% 1.00x (?)
DropFirstAnyCollection 51 52 +2.0% 0.98x (?)
DropFirstAnyCollectionLazy 73549 73644 +0.1% 1.00x (?)
DropFirstAnySeqCRangeIter 26670 27872 +4.5% 0.96x (?)
DropFirstAnySeqCRangeIterLazy 27724 27874 +0.5% 0.99x (?)
DropFirstAnySeqCntRange 48 48 +0.0% 1.00x
DropFirstAnySeqCntRangeLazy 48 48 +0.0% 1.00x
DropFirstAnySequence 5925 5952 +0.5% 1.00x (?)
DropFirstAnySequenceLazy 6012 6081 +1.1% 0.99x (?)
DropFirstArrayLazy 29 29 +0.0% 1.00x
DropFirstCountableRange 17 17 +0.0% 1.00x
DropFirstCountableRangeLazy 17 17 +0.0% 1.00x
DropFirstSequence 1905 1905 +0.0% 1.00x
DropFirstSequenceLazy 1835 1834 -0.1% 1.00x (?)
DropLastAnyCollection 20 20 +0.0% 1.00x
DropLastAnyCollectionLazy 24489 24442 -0.2% 1.00x (?)
DropLastAnySeqCRangeIter 4453 4452 -0.0% 1.00x (?)
DropLastAnySeqCRangeIterLazy 4452 4486 +0.8% 0.99x (?)
DropLastAnySeqCntRange 15 15 +0.0% 1.00x
DropLastAnySeqCntRangeLazy 15 15 +0.0% 1.00x
DropLastAnySequence 6345 6350 +0.1% 1.00x (?)
DropLastAnySequenceLazy 6308 6454 +2.3% 0.98x (?)
DropLastArray 7 7 +0.0% 1.00x
DropLastArrayLazy 7 7 +0.0% 1.00x
DropLastCountableRange 6 6 +0.0% 1.00x
DropLastCountableRangeLazy 6 6 +0.0% 1.00x
DropLastSequence 581 588 +1.2% 0.99x (?)
DropLastSequenceLazy 581 590 +1.5% 0.98x (?)
DropWhileAnyCollection 64 64 +0.0% 1.00x
DropWhileAnyCollectionLazy 84 84 +0.0% 1.00x
DropWhileAnySeqCRangeIter 21577 21785 +1.0% 0.99x (?)
DropWhileAnySeqCRangeIterLazy 85 85 +0.0% 1.00x
DropWhileAnySeqCntRange 60 59 -1.7% 1.02x (?)
DropWhileAnySeqCntRangeLazy 85 85 +0.0% 1.00x
DropWhileAnySequence 6880 6860 -0.3% 1.00x (?)
DropWhileAnySequenceLazy 1825 1824 -0.1% 1.00x (?)
DropWhileArray 40 41 +2.5% 0.98x (?)
DropWhileArrayLazy 74 74 +0.0% 1.00x
DropWhileCountableRange 18 18 +0.0% 1.00x
DropWhileCountableRangeLazy 66 66 +0.0% 1.00x
DropWhileSequence 1533 1532 -0.1% 1.00x (?)
DropWhileSequenceLazy 44 44 +0.0% 1.00x
EqualStringSubstring 367 368 +0.3% 1.00x (?)
EqualSubstringString 368 368 +0.0% 1.00x
EqualSubstringSubstring 373 375 +0.5% 0.99x (?)
EqualSubstringSubstringGenericEquatable 377 370 -1.9% 1.02x (?)
ErrorHandling 1931 1947 +0.8% 0.99x (?)
ExclusivityGlobal 2 2 +0.0% 1.00x
ExclusivityInMatSet 17 17 +0.0% 1.00x
ExclusivityIndependent 2 2 +0.0% 1.00x
FilterEvenUsingReduce 1225 1232 +0.6% 0.99x (?)
FilterEvenUsingReduceInto 138 140 +1.4% 0.99x (?)
FrequenciesUsingReduce 7021 7012 -0.1% 1.00x (?)
FrequenciesUsingReduceInto 3907 3929 +0.6% 0.99x (?)
Hanoi 3408 3587 +5.3% 0.95x (?)
HashTest 1623 1670 +2.9% 0.97x (?)
Histogram 262 273 +4.2% 0.96x (?)
Integrate 238 249 +4.6% 0.96x (?)
IterateData 1301 1324 +1.8% 0.98x (?)
Join 355 367 +3.4% 0.97x (?)
LazilyFilteredArrays 62841 62984 +0.2% 1.00x (?)
LazilyFilteredRange 3526 3404 -3.5% 1.04x (?)
LessSubstringSubstring 373 387 +3.8% 0.96x (?)
LessSubstringSubstringGenericComparable 369 380 +3.0% 0.97x (?)
LinkedList 6566 6558 -0.1% 1.00x (?)
MapReduceAnyCollectionShort 2013 2068 +2.7% 0.97x (?)
MapReduceClass 3205 3201 -0.1% 1.00x (?)
MapReduceClassShort 4285 4346 +1.4% 0.99x (?)
MapReduceLazyCollectionShort 4 4 +0.0% 1.00x
MapReduceLazySequence 85 85 +0.0% 1.00x
MapReduceSequence 416 419 +0.7% 0.99x (?)
MapReduceShort 1885 1925 +2.1% 0.98x (?)
MapReduceShortString 20 21 +5.0% 0.95x (?)
Memset 221 221 +0.0% 1.00x
MonteCarloE 9762 9751 -0.1% 1.00x (?)
MonteCarloPi 41463 41531 +0.2% 1.00x (?)
NSDictionaryCastToSwift 4989 5018 +0.6% 0.99x (?)
NSError 274 273 -0.4% 1.00x (?)
NSStringConversion 342 344 +0.6% 0.99x (?)
ObjectAllocation 168 168 +0.0% 1.00x
ObjectiveCBridgeFromNSArrayAnyObject 21410 21639 +1.1% 0.99x (?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 3252 3365 +3.5% 0.97x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 37038 38769 +4.7% 0.96x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 32008 32616 +1.9% 0.98x (?)
ObjectiveCBridgeFromNSDictionaryAnyObject 115694 118383 +2.3% 0.98x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 88514 92320 +4.3% 0.96x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 97146 101079 +4.0% 0.96x (?)
ObjectiveCBridgeFromNSSetAnyObject 61064 63889 +4.6% 0.96x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 4011 4205 +4.8% 0.95x (?)
ObjectiveCBridgeFromNSSetAnyObjectToString 64320 66386 +3.2% 0.97x (?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 64322 66375 +3.2% 0.97x (?)
ObjectiveCBridgeFromNSString 960 995 +3.6% 0.96x (?)
ObjectiveCBridgeFromNSStringForced 1816 1819 +0.2% 1.00x (?)
ObjectiveCBridgeStubDataAppend 3711 3717 +0.2% 1.00x (?)
ObjectiveCBridgeStubDateAccess 172 176 +2.3% 0.98x (?)
ObjectiveCBridgeStubDateMutation 257 259 +0.8% 0.99x (?)
ObjectiveCBridgeStubFromArrayOfNSString 24749 24711 -0.2% 1.00x (?)
ObjectiveCBridgeStubFromNSDate 3579 3494 -2.4% 1.02x (?)
ObjectiveCBridgeStubFromNSDateRef 4093 3948 -3.5% 1.04x (?)
ObjectiveCBridgeStubFromNSString 520 522 +0.4% 1.00x (?)
ObjectiveCBridgeStubFromNSStringRef 149 150 +0.7% 0.99x
ObjectiveCBridgeStubNSDataAppend 2421 2390 -1.3% 1.01x (?)
ObjectiveCBridgeStubNSDateMutationRef 12138 11900 -2.0% 1.02x (?)
ObjectiveCBridgeStubToArrayOfNSString 28753 28100 -2.3% 1.02x (?)
ObjectiveCBridgeStubToNSDate 12950 13551 +4.6% 0.96x (?)
ObjectiveCBridgeStubToNSDateRef 3116 3075 -1.3% 1.01x (?)
ObjectiveCBridgeStubToNSString 1406 1418 +0.9% 0.99x (?)
ObjectiveCBridgeStubToNSStringRef 110 113 +2.7% 0.97x (?)
ObjectiveCBridgeStubURLAppendPathRef 212784 211815 -0.5% 1.00x (?)
ObjectiveCBridgeToNSArray 28803 28642 -0.6% 1.01x (?)
ObjectiveCBridgeToNSDictionary 45883 45341 -1.2% 1.01x (?)
ObjectiveCBridgeToNSSet 37918 39867 +5.1% 0.95x (?)
ObjectiveCBridgeToNSString 1198 1198 +0.0% 1.00x
ObserverClosure 2183 2183 +0.0% 1.00x
ObserverForwarderStruct 860 858 -0.2% 1.00x (?)
ObserverPartiallyAppliedMethod 3569 3574 +0.1% 1.00x (?)
ObserverUnappliedMethod 2354 2341 -0.6% 1.01x (?)
OpenClose 3 3 +0.0% 1.00x
Phonebook 5777 6010 +4.0% 0.96x (?)
PolymorphicCalls 16 16 +0.0% 1.00x
PopFrontArray 1212 1215 +0.2% 1.00x (?)
PopFrontArrayGeneric 1261 1230 -2.5% 1.03x (?)
PrefixAnyCollection 52 52 +0.0% 1.00x
PrefixAnyCollectionLazy 73491 74334 +1.1% 0.99x (?)
PrefixAnySeqCRangeIter 21541 21229 -1.4% 1.01x (?)
PrefixAnySeqCRangeIterLazy 21423 21343 -0.4% 1.00x (?)
PrefixAnySeqCntRange 47 48 +2.1% 0.98x (?)
PrefixAnySeqCntRangeLazy 48 48 +0.0% 1.00x
PrefixAnySequenceLazy 5359 5272 -1.6% 1.02x (?)
PrefixArray 29 29 +0.0% 1.00x
PrefixArrayLazy 29 29 +0.0% 1.00x
PrefixCountableRange 17 17 +0.0% 1.00x
PrefixCountableRangeLazy 17 17 +0.0% 1.00x
PrefixSequence 1430 1431 +0.1% 1.00x (?)
PrefixSequenceLazy 1377 1377 +0.0% 1.00x
PrefixWhileAnyCollection 87 87 +0.0% 1.00x
PrefixWhileAnyCollectionLazy 62 62 +0.0% 1.00x
PrefixWhileAnySeqCRangeIter 12183 12195 +0.1% 1.00x (?)
PrefixWhileAnySeqCRangeIterLazy 62 62 +0.0% 1.00x
PrefixWhileAnySeqCntRange 83 83 +0.0% 1.00x
PrefixWhileAnySeqCntRangeLazy 62 62 +0.0% 1.00x
PrefixWhileAnySequence 13529 13509 -0.1% 1.00x (?)
PrefixWhileAnySequenceLazy 1356 1355 -0.1% 1.00x (?)
PrefixWhileArray 64 64 +0.0% 1.00x
PrefixWhileArrayLazy 35 35 +0.0% 1.00x
PrefixWhileCountableRange 28 28 +0.0% 1.00x
PrefixWhileCountableRangeLazy 17 17 +0.0% 1.00x
PrefixWhileSequence 339 347 +2.4% 0.98x (?)
PrefixWhileSequenceLazy 26 26 +0.0% 1.00x
Prims 706 714 +1.1% 0.99x (?)
PrimsSplit 721 711 -1.4% 1.01x (?)
ProtocolDispatch 2608 2575 -1.3% 1.01x (?)
ProtocolDispatch2 120 123 +2.5% 0.98x (?)
RC4 161 162 +0.6% 0.99x (?)
RGBHistogram 2102 2058 -2.1% 1.02x (?)
RGBHistogramOfObjects 21970 21950 -0.1% 1.00x (?)
RangeAssignment 346 350 +1.2% 0.99x (?)
RangeIterationSigned64 143 144 +0.7% 0.99x (?)
RangeIterationUnsigned 143 147 +2.8% 0.97x (?)
RecursiveOwnedParameter 2183 2182 -0.0% 1.00x (?)
ReversedArray 42 42 +0.0% 1.00x
ReversedBidirectional 27701 27685 -0.1% 1.00x (?)
ReversedDictionary 92 93 +1.1% 0.99x (?)
SetExclusiveOr 2667 2669 +0.1% 1.00x (?)
SetExclusiveOr_OfObjects 7681 7882 +2.6% 0.97x (?)
SetIntersect 256 249 -2.7% 1.03x (?)
SetIntersect_OfObjects 1620 1615 -0.3% 1.00x (?)
SetIsSubsetOf 277 277 +0.0% 1.00x
SetIsSubsetOf_OfObjects 346 346 +0.0% 1.00x
SetUnion 2452 2397 -2.2% 1.02x (?)
SetUnion_OfObjects 6398 6475 +1.2% 0.99x (?)
SevenBoom 1406 1393 -0.9% 1.01x (?)
SortLargeExistentials 7802 8033 +3.0% 0.97x (?)
SortLettersInPlace 1084 1086 +0.2% 1.00x (?)
SortSortedStrings 868 891 +2.6% 0.97x (?)
SortStrings 1631 1686 +3.4% 0.97x (?)
SortStringsUnicode 8049 8246 +2.4% 0.98x (?)
StackPromo 21448 21467 +0.1% 1.00x (?)
StaticArray 5 5 +0.0% 1.00x
StrComplexWalk 1506 1577 +4.7% 0.95x (?)
StrToInt 1770 1818 +2.7% 0.97x (?)
StringAdder 3312 3404 +2.8% 0.97x (?)
StringBuilder 960 994 +3.5% 0.97x (?)
StringBuilderLong 904 923 +2.1% 0.98x (?)
StringEdits 164723 166897 +1.3% 0.99x (?)
StringEnumRawValueInitialization 766 783 +2.2% 0.98x (?)
StringEqualPointerComparison 348 358 +2.9% 0.97x (?)
StringFromLongWholeSubstring 168 164 -2.4% 1.02x (?)
StringFromLongWholeSubstringGeneric 81 81 +0.0% 1.00x
StringHasPrefix 8 8 +0.0% 1.00x
StringHasPrefixUnicode 14213 14110 -0.7% 1.01x (?)
StringHasSuffix 8 8 +0.0% 1.00x
StringHasSuffixUnicode 58188 58711 +0.9% 0.99x (?)
StringInterpolation 10420 10439 +0.2% 1.00x (?)
StringMatch 7181 7227 +0.6% 0.99x (?)
StringUTF16Builder 1794 1808 +0.8% 0.99x (?)
StringWalk 1443 1473 +2.1% 0.98x (?)
StringWithCString 60069 61955 +3.1% 0.97x (?)
SubstringComparable 1541 1586 +2.9% 0.97x (?)
SubstringEqualString 1402 1463 +4.4% 0.96x (?)
SubstringEquatable 3606 3602 -0.1% 1.00x (?)
SubstringFromLongString 10 10 +0.0% 1.00x
SubstringFromLongStringGeneric 69 69 +0.0% 1.00x
SuffixAnyCollection 20 20 +0.0% 1.00x
SuffixAnyCollectionLazy 24571 24461 -0.4% 1.00x (?)
SuffixAnySeqCRangeIter 4761 4808 +1.0% 0.99x (?)
SuffixAnySeqCRangeIterLazy 4766 4765 -0.0% 1.00x (?)
SuffixAnySeqCntRange 15 15 +0.0% 1.00x
SuffixAnySeqCntRangeLazy 15 15 +0.0% 1.00x
SuffixAnySequence 6407 6368 -0.6% 1.01x (?)
SuffixAnySequenceLazy 6344 6359 +0.2% 1.00x (?)
SuffixArray 7 7 +0.0% 1.00x
SuffixArrayLazy 7 7 +0.0% 1.00x
SuffixCountableRange 6 6 +0.0% 1.00x
SuffixCountableRangeLazy 6 6 +0.0% 1.00x
SuffixSequence 4373 4377 +0.1% 1.00x (?)
SuffixSequenceLazy 4378 4402 +0.5% 0.99x (?)
SumUsingReduce 92 91 -1.1% 1.01x (?)
SumUsingReduceInto 91 92 +1.1% 0.99x (?)
SuperChars 78576 78771 +0.2% 1.00x (?)
TwoSum 885 889 +0.5% 1.00x (?)
TypeFlood 0 0 +0.0% 1.00x
UTF8Decode 244 243 -0.4% 1.00x (?)
Walsh 361 357 -1.1% 1.01x (?)
XorLoop 326 326 +0.0% 1.00x

Unoptimized (Onone)

Regression (6)
TEST OLD NEW DELTA SPEEDUP
CharIndexing_ascii_unicodeScalars_Backwards 505361 541593 +7.2% 0.93x
Chars 47326 50638 +7.0% 0.93x
CaptureProp 117014 125066 +6.9% 0.94x (?)
ArrayOfGenericPOD 1221 1305 +6.9% 0.94x (?)
SuffixArray 2083 2216 +6.4% 0.94x
CharIndexing_tweet_unicodeScalars 974691 1028745 +5.5% 0.95x
Improvement (11)
TEST OLD NEW DELTA SPEEDUP
ArrayOfPOD 746 669 -10.3% 1.12x
DropWhileArrayLazy 18766 17018 -9.3% 1.10x
ArrayAppendLatin1 79014 74364 -5.9% 1.06x (?)
ObjectiveCBridgeStubDateAccess 1271 1200 -5.6% 1.06x
ArrayAppendUTF16 75968 71877 -5.4% 1.06x (?)
DropFirstAnySequence 16129 15268 -5.3% 1.06x (?)
DropWhileAnyCollectionLazy 30116 28531 -5.3% 1.06x
CStringLongAscii 4848 4601 -5.1% 1.05x (?)
ArrayAppendSequence 80921 76858 -5.0% 1.05x
ObjectiveCBridgeStubFromNSDate 4197 3990 -4.9% 1.05x
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 104786 99683 -4.9% 1.05x (?)
No Changes (317)
TEST OLD NEW DELTA SPEEDUP
AngryPhonebook 4767 4747 -0.4% 1.00x (?)
AnyHashableWithAClass 81794 80135 -2.0% 1.02x (?)
Array2D 605631 604908 -0.1% 1.00x (?)
ArrayAppend 4731 4754 +0.5% 1.00x (?)
ArrayAppendArrayOfInt 619 619 +0.0% 1.00x
ArrayAppendAscii 49857 51146 +2.6% 0.97x (?)
ArrayAppendFromGeneric 622 622 +0.0% 1.00x
ArrayAppendGenericStructs 1194 1200 +0.5% 1.00x (?)
ArrayAppendLazyMap 217245 225313 +3.7% 0.96x (?)
ArrayAppendOptionals 1194 1198 +0.3% 1.00x (?)
ArrayAppendRepeatCol 234695 225399 -4.0% 1.04x (?)
ArrayAppendReserved 4499 4379 -2.7% 1.03x (?)
ArrayAppendStrings 14537 15106 +3.9% 0.96x (?)
ArrayAppendToFromGeneric 622 640 +2.9% 0.97x (?)
ArrayAppendToGeneric 623 622 -0.2% 1.00x (?)
ArrayInClass 6204 6159 -0.7% 1.01x (?)
ArrayLiteral 1660 1658 -0.1% 1.00x (?)
ArrayOfGenericRef 9530 9528 -0.0% 1.00x (?)
ArrayOfRef 9199 9048 -1.6% 1.02x (?)
ArrayPlusEqualArrayOfInt 620 638 +2.9% 0.97x
ArrayPlusEqualFiveElementCollection 300386 295786 -1.5% 1.02x (?)
ArrayPlusEqualSingleElementCollection 296948 295255 -0.6% 1.01x (?)
ArrayPlusEqualThreeElements 10782 10826 +0.4% 1.00x (?)
ArraySetElement 4521 4519 -0.0% 1.00x (?)
ArraySubscript 84060 81555 -3.0% 1.03x (?)
ArrayValueProp 3404 3405 +0.0% 1.00x (?)
ArrayValueProp2 18017 18314 +1.6% 0.98x (?)
ArrayValueProp3 4028 4121 +2.3% 0.98x (?)
ArrayValueProp4 4034 4099 +1.6% 0.98x (?)
BitCount 1422 1423 +0.1% 1.00x (?)
ByteSwap 3809 3811 +0.1% 1.00x (?)
CStringLongNonAscii 2383 2379 -0.2% 1.00x (?)
CStringShortAscii 8624 8805 +2.1% 0.98x (?)
Calculator 1157 1135 -1.9% 1.02x (?)
CharIndexing_ascii_unicodeScalars 479043 494900 +3.3% 0.97x (?)
CharIndexing_chinese_unicodeScalars 358148 375142 +4.7% 0.95x
CharIndexing_chinese_unicodeScalars_Backwards 396247 396665 +0.1% 1.00x (?)
CharIndexing_japanese_unicodeScalars 584275 592396 +1.4% 0.99x (?)
CharIndexing_japanese_unicodeScalars_Backwards 620747 633517 +2.1% 0.98x (?)
CharIndexing_korean_unicodeScalars 466440 481970 +3.3% 0.97x (?)
CharIndexing_korean_unicodeScalars_Backwards 505468 500372 -1.0% 1.01x (?)
CharIndexing_punctuatedJapanese_unicodeScalars 83447 86727 +3.9% 0.96x (?)
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 87837 89202 +1.6% 0.98x (?)
CharIndexing_punctuated_unicodeScalars 107198 112362 +4.8% 0.95x
CharIndexing_punctuated_unicodeScalars_Backwards 113286 115949 +2.4% 0.98x (?)
CharIndexing_russian_unicodeScalars 407142 419023 +2.9% 0.97x
CharIndexing_russian_unicodeScalars_Backwards 435660 440535 +1.1% 0.99x (?)
CharIndexing_tweet_unicodeScalars_Backwards 1032023 1047198 +1.5% 0.99x (?)
CharIndexing_utf16_unicodeScalars 533239 542165 +1.7% 0.98x
CharIndexing_utf16_unicodeScalars_Backwards 572324 576007 +0.6% 0.99x (?)
CharIteration_ascii_unicodeScalars 178482 181285 +1.6% 0.98x (?)
CharIteration_ascii_unicodeScalars_Backwards 325988 318360 -2.3% 1.02x (?)
CharIteration_chinese_unicodeScalars 136710 139603 +2.1% 0.98x (?)
CharIteration_chinese_unicodeScalars_Backwards 245872 244098 -0.7% 1.01x (?)
CharIteration_japanese_unicodeScalars 220447 218136 -1.0% 1.01x (?)
CharIteration_japanese_unicodeScalars_Backwards 382739 387525 +1.3% 0.99x (?)
CharIteration_korean_unicodeScalars 174474 179265 +2.7% 0.97x (?)
CharIteration_korean_unicodeScalars_Backwards 304792 309875 +1.7% 0.98x (?)
CharIteration_punctuatedJapanese_unicodeScalars 32953 32083 -2.6% 1.03x
CharIteration_punctuatedJapanese_unicodeScalars_Backwards 55871 55655 -0.4% 1.00x (?)
CharIteration_punctuated_unicodeScalars 40036 41427 +3.5% 0.97x (?)
CharIteration_punctuated_unicodeScalars_Backwards 72722 69809 -4.0% 1.04x (?)
CharIteration_russian_unicodeScalars 153858 151509 -1.5% 1.02x (?)
CharIteration_russian_unicodeScalars_Backwards 264964 263244 -0.6% 1.01x (?)
CharIteration_tweet_unicodeScalars 358786 359893 +0.3% 1.00x (?)
CharIteration_tweet_unicodeScalars_Backwards 625280 640664 +2.5% 0.98x (?)
CharIteration_utf16_unicodeScalars 204194 197587 -3.2% 1.03x (?)
CharIteration_utf16_unicodeScalars_Backwards 388334 387613 -0.2% 1.00x (?)
CharacterLiteralsLarge 6026 6008 -0.3% 1.00x (?)
CharacterLiteralsSmall 669 680 +1.6% 0.98x (?)
ClassArrayGetter 997 1035 +3.8% 0.96x
DeadArray 112142 112064 -0.1% 1.00x (?)
Dictionary 3076 2969 -3.5% 1.04x (?)
Dictionary2 3380 3382 +0.1% 1.00x (?)
Dictionary2OfObjects 5908 5908 +0.0% 1.00x
Dictionary3 1300 1292 -0.6% 1.01x (?)
Dictionary3OfObjects 2252 2235 -0.8% 1.01x (?)
DictionaryBridge 2533 2560 +1.1% 0.99x (?)
DictionaryGroup 5379 5597 +4.1% 0.96x
DictionaryGroupOfObjects 8034 8211 +2.2% 0.98x (?)
DictionaryLiteral 8598 8346 -2.9% 1.03x (?)
DictionaryOfObjects 6453 6418 -0.5% 1.01x (?)
DictionaryRemove 21247 21356 +0.5% 0.99x (?)
DictionaryRemoveOfObjects 58091 57522 -1.0% 1.01x (?)
DictionarySwap 5221 5304 +1.6% 0.98x (?)
DictionarySwapOfObjects 22608 22912 +1.3% 0.99x (?)
DropFirstAnyCollection 19890 20524 +3.2% 0.97x (?)
DropFirstAnyCollectionLazy 138578 139992 +1.0% 0.99x (?)
DropFirstAnySeqCRangeIter 30642 30188 -1.5% 1.02x (?)
DropFirstAnySeqCRangeIterLazy 30987 30286 -2.3% 1.02x (?)
DropFirstAnySeqCntRange 20364 20692 +1.6% 0.98x (?)
DropFirstAnySeqCntRangeLazy 20809 20167 -3.1% 1.03x (?)
DropFirstAnySequenceLazy 15506 14898 -3.9% 1.04x
DropFirstArray 6195 6304 +1.8% 0.98x
DropFirstArrayLazy 43856 45004 +2.6% 0.97x (?)
DropFirstCountableRange 459 473 +3.1% 0.97x (?)
DropFirstCountableRangeLazy 40634 40977 +0.8% 0.99x (?)
DropFirstSequence 14440 14214 -1.6% 1.02x (?)
DropFirstSequenceLazy 14233 14201 -0.2% 1.00x (?)
DropLastAnyCollection 6792 6635 -2.3% 1.02x (?)
DropLastAnyCollectionLazy 46662 45934 -1.6% 1.02x (?)
DropLastAnySeqCRangeIter 47436 46556 -1.9% 1.02x (?)
DropLastAnySeqCRangeIterLazy 47066 47265 +0.4% 1.00x (?)
DropLastAnySeqCntRange 6738 6796 +0.9% 0.99x (?)
DropLastAnySeqCntRangeLazy 6803 6583 -3.2% 1.03x
DropLastAnySequence 32756 32706 -0.2% 1.00x (?)
DropLastAnySequenceLazy 32689 32447 -0.7% 1.01x
DropLastArray 2136 2218 +3.8% 0.96x
DropLastArrayLazy 15008 14533 -3.2% 1.03x (?)
DropLastCountableRange 166 163 -1.8% 1.02x (?)
DropLastCountableRangeLazy 13577 13649 +0.5% 0.99x (?)
DropLastSequence 33284 32404 -2.6% 1.03x (?)
DropLastSequenceLazy 32359 31673 -2.1% 1.02x (?)
DropWhileAnyCollection 26277 25632 -2.5% 1.03x (?)
DropWhileAnySeqCRangeIter 33058 32908 -0.5% 1.00x (?)
DropWhileAnySeqCRangeIterLazy 28786 28959 +0.6% 0.99x (?)
DropWhileAnySeqCntRange 26572 26437 -0.5% 1.01x (?)
DropWhileAnySeqCntRangeLazy 29111 28675 -1.5% 1.02x (?)
DropWhileAnySequence 18356 18245 -0.6% 1.01x (?)
DropWhileAnySequenceLazy 15057 14418 -4.2% 1.04x
DropWhileArray 9801 9904 +1.1% 0.99x
DropWhileCountableRange 6635 6483 -2.3% 1.02x (?)
DropWhileCountableRangeLazy 28829 27533 -4.5% 1.05x
DropWhileSequence 17301 17654 +2.0% 0.98x (?)
DropWhileSequenceLazy 13527 13392 -1.0% 1.01x (?)
EqualStringSubstring 666 678 +1.8% 0.98x (?)
EqualSubstringString 696 677 -2.7% 1.03x (?)
EqualSubstringSubstring 789 764 -3.2% 1.03x (?)
EqualSubstringSubstringGenericEquatable 423 416 -1.7% 1.02x (?)
ErrorHandling 6828 6768 -0.9% 1.01x (?)
ExclusivityGlobal 171 172 +0.6% 0.99x (?)
ExclusivityInMatSet 304 307 +1.0% 0.99x (?)
ExclusivityIndependent 122 123 +0.8% 0.99x (?)
FilterEvenUsingReduce 4163 4117 -1.1% 1.01x (?)
FilterEvenUsingReduceInto 2433 2458 +1.0% 0.99x (?)
FrequenciesUsingReduce 15981 15609 -2.3% 1.02x (?)
FrequenciesUsingReduceInto 9097 8738 -3.9% 1.04x (?)
Hanoi 19121 18645 -2.5% 1.03x (?)
HashTest 17290 17160 -0.8% 1.01x (?)
Histogram 9034 8852 -2.0% 1.02x (?)
Integrate 679 673 -0.9% 1.01x (?)
IterateData 12653 13023 +2.9% 0.97x (?)
Join 1495 1467 -1.9% 1.02x (?)
LazilyFilteredArrayContains 973427 965153 -0.8% 1.01x (?)
LazilyFilteredArrays 1722723 1719644 -0.2% 1.00x (?)
LazilyFilteredRange 703795 718555 +2.1% 0.98x (?)
LessSubstringSubstring 789 793 +0.5% 0.99x
LessSubstringSubstringGenericComparable 445 428 -3.8% 1.04x (?)
LinkedList 39136 38417 -1.8% 1.02x (?)
MapReduce 36602 36350 -0.7% 1.01x (?)
MapReduceAnyCollection 36607 37363 +2.1% 0.98x (?)
MapReduceAnyCollectionShort 48567 49636 +2.2% 0.98x (?)
MapReduceClass 43791 42189 -3.7% 1.04x
MapReduceClassShort 53269 53501 +0.4% 1.00x (?)
MapReduceLazyCollection 33368 33682 +0.9% 0.99x (?)
MapReduceLazyCollectionShort 43981 44547 +1.3% 0.99x (?)
MapReduceLazySequence 28226 28836 +2.2% 0.98x (?)
MapReduceSequence 43273 43814 +1.3% 0.99x (?)
MapReduceShort 49211 49392 +0.4% 1.00x (?)
MapReduceShortString 276 276 +0.0% 1.00x
MapReduceString 2608 2601 -0.3% 1.00x (?)
Memset 44731 44655 -0.2% 1.00x (?)
MonteCarloE 939439 900204 -4.2% 1.04x (?)
MonteCarloPi 4150418 3992076 -3.8% 1.04x (?)
NSDictionaryCastToSwift 6546 6380 -2.5% 1.03x (?)
NSError 716 721 +0.7% 0.99x (?)
NSStringConversion 387 387 +0.0% 1.00x
NopDeinit 171221 170089 -0.7% 1.01x (?)
ObjectAllocation 1453 1478 +1.7% 0.98x (?)
ObjectiveCBridgeFromNSArrayAnyObject 24238 24923 +2.8% 0.97x (?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 6821 7144 +4.7% 0.95x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 40937 40850 -0.2% 1.00x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 35176 34877 -0.9% 1.01x (?)
ObjectiveCBridgeFromNSDictionaryAnyObject 126888 123733 -2.5% 1.03x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 7500 7730 +3.1% 0.97x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 98043 94865 -3.2% 1.03x (?)
ObjectiveCBridgeFromNSSetAnyObject 68584 67120 -2.1% 1.02x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 7507 7452 -0.7% 1.01x (?)
ObjectiveCBridgeFromNSSetAnyObjectToString 73136 73990 +1.2% 0.99x (?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 73054 71265 -2.4% 1.03x (?)
ObjectiveCBridgeFromNSString 3987 4022 +0.9% 0.99x (?)
ObjectiveCBridgeFromNSStringForced 2263 2272 +0.4% 1.00x (?)
ObjectiveCBridgeStubDataAppend 4530 4558 +0.6% 0.99x (?)
ObjectiveCBridgeStubDateMutation 688 697 +1.3% 0.99x
ObjectiveCBridgeStubFromArrayOfNSString 25465 26042 +2.3% 0.98x (?)
ObjectiveCBridgeStubFromNSDateRef 4678 4696 +0.4% 1.00x (?)
ObjectiveCBridgeStubFromNSString 594 586 -1.3% 1.01x (?)
ObjectiveCBridgeStubFromNSStringRef 192 198 +3.1% 0.97x (?)
ObjectiveCBridgeStubNSDataAppend 2941 2987 +1.6% 0.98x (?)
ObjectiveCBridgeStubNSDateMutationRef 15722 15735 +0.1% 1.00x (?)
ObjectiveCBridgeStubNSDateRefAccess 1398 1416 +1.3% 0.99x (?)
ObjectiveCBridgeStubToArrayOfNSString 29078 28994 -0.3% 1.00x (?)
ObjectiveCBridgeStubToNSDate 15163 14606 -3.7% 1.04x (?)
ObjectiveCBridgeStubToNSDateRef 3437 3355 -2.4% 1.02x (?)
ObjectiveCBridgeStubToNSString 1511 1462 -3.2% 1.03x
ObjectiveCBridgeStubToNSStringRef 166 162 -2.4% 1.02x
ObjectiveCBridgeStubURLAppendPath 215155 219141 +1.9% 0.98x (?)
ObjectiveCBridgeStubURLAppendPathRef 219452 221787 +1.1% 0.99x (?)
ObjectiveCBridgeToNSArray 29446 28980 -1.6% 1.02x (?)
ObjectiveCBridgeToNSDictionary 46271 44510 -3.8% 1.04x (?)
ObjectiveCBridgeToNSSet 40706 39778 -2.3% 1.02x (?)
ObjectiveCBridgeToNSString 1304 1327 +1.8% 0.98x (?)
ObserverClosure 6804 6795 -0.1% 1.00x (?)
ObserverForwarderStruct 4855 4897 +0.9% 0.99x (?)
ObserverPartiallyAppliedMethod 8072 8171 +1.2% 0.99x (?)
ObserverUnappliedMethod 8535 8599 +0.7% 0.99x (?)
OpenClose 397 384 -3.3% 1.03x (?)
Phonebook 22572 21633 -4.2% 1.04x
PolymorphicCalls 5233 5191 -0.8% 1.01x (?)
PopFrontArray 10029 9967 -0.6% 1.01x (?)
PopFrontArrayGeneric 9003 8927 -0.8% 1.01x (?)
PopFrontUnsafePointer 7659 7682 +0.3% 1.00x (?)
PrefixAnyCollection 19821 20440 +3.1% 0.97x (?)
PrefixAnyCollectionLazy 138491 142883 +3.2% 0.97x (?)
PrefixAnySeqCRangeIter 24015 24219 +0.8% 0.99x (?)
PrefixAnySeqCRangeIterLazy 24604 24201 -1.6% 1.02x (?)
PrefixAnySeqCntRange 20477 20469 -0.0% 1.00x (?)
PrefixAnySeqCntRangeLazy 20668 20193 -2.3% 1.02x (?)
PrefixAnySequence 12980 12474 -3.9% 1.04x
PrefixAnySequenceLazy 12587 12501 -0.7% 1.01x (?)
PrefixArray 6220 6462 +3.9% 0.96x
PrefixArrayLazy 44070 43834 -0.5% 1.01x (?)
PrefixCountableRange 472 485 +2.8% 0.97x (?)
PrefixCountableRangeLazy 40539 41954 +3.5% 0.97x
PrefixSequence 11717 11452 -2.3% 1.02x (?)
PrefixSequenceLazy 11476 11451 -0.2% 1.00x
PrefixWhileAnyCollection 38385 38678 +0.8% 0.99x (?)
PrefixWhileAnyCollectionLazy 23663 23453 -0.9% 1.01x (?)
PrefixWhileAnySeqCRangeIter 42843 44519 +3.9% 0.96x (?)
PrefixWhileAnySeqCRangeIterLazy 22945 23013 +0.3% 1.00x (?)
PrefixWhileAnySeqCntRange 38751 39030 +0.7% 0.99x (?)
PrefixWhileAnySeqCntRangeLazy 23641 23517 -0.5% 1.01x (?)
PrefixWhileAnySequence 31195 31905 +2.3% 0.98x (?)
PrefixWhileAnySequenceLazy 13026 12982 -0.3% 1.00x (?)
PrefixWhileArray 17323 17578 +1.5% 0.99x (?)
PrefixWhileArrayLazy 14935 14872 -0.4% 1.00x (?)
PrefixWhileCountableRange 18464 18281 -1.0% 1.01x (?)
PrefixWhileCountableRangeLazy 23192 23081 -0.5% 1.00x (?)
PrefixWhileSequence 31055 31659 +1.9% 0.98x (?)
PrefixWhileSequenceLazy 12388 12011 -3.0% 1.03x
Prims 10316 10264 -0.5% 1.01x (?)
PrimsSplit 10398 10231 -1.6% 1.02x (?)
ProtocolDispatch 7355 7450 +1.3% 0.99x (?)
ProtocolDispatch2 500 500 +0.0% 1.00x
RC4 18645 18659 +0.1% 1.00x (?)
RGBHistogram 34553 33186 -4.0% 1.04x
RGBHistogramOfObjects 101574 103223 +1.6% 0.98x (?)
RangeAssignment 5489 5415 -1.3% 1.01x (?)
RangeIterationSigned 17642 17888 +1.4% 0.99x (?)
RangeIterationSigned64 52471 52586 +0.2% 1.00x (?)
RangeIterationUnsigned 47217 48089 +1.8% 0.98x (?)
RecursiveOwnedParameter 10474 10398 -0.7% 1.01x (?)
ReversedArray 41718 41288 -1.0% 1.01x (?)
ReversedBidirectional 74173 73767 -0.5% 1.01x (?)
ReversedDictionary 28683 29550 +3.0% 0.97x
SetExclusiveOr 22382 22284 -0.4% 1.00x (?)
SetExclusiveOr_OfObjects 46962 46665 -0.6% 1.01x
SetIntersect 11980 12185 +1.7% 0.98x (?)
SetIntersect_OfObjects 12206 12516 +2.5% 0.98x (?)
SetIsSubsetOf 1830 1880 +2.7% 0.97x
SetIsSubsetOf_OfObjects 1517 1526 +0.6% 0.99x (?)
SetUnion 12069 11540 -4.4% 1.05x
SetUnion_OfObjects 32569 32637 +0.2% 1.00x (?)
SevenBoom 1575 1567 -0.5% 1.01x (?)
Sim2DArray 42636 42675 +0.1% 1.00x (?)
SortLargeExistentials 16757 17135 +2.3% 0.98x (?)
SortLettersInPlace 2953 3041 +3.0% 0.97x (?)
SortSortedStrings 1408 1403 -0.4% 1.00x (?)
SortStrings 2572 2546 -1.0% 1.01x (?)
SortStringsUnicode 9255 9048 -2.2% 1.02x
StackPromo 102726 99855 -2.8% 1.03x (?)
StaticArray 4442 4590 +3.3% 0.97x
StrComplexWalk 7022 7016 -0.1% 1.00x (?)
StrToInt 122772 123628 +0.7% 0.99x (?)
StringAdder 3714 3699 -0.4% 1.00x (?)
StringBuilder 7072 6982 -1.3% 1.01x
StringBuilderLong 1086 1112 +2.4% 0.98x (?)
StringEdits 374280 378688 +1.2% 0.99x (?)
StringEnumRawValueInitialization 12498 12425 -0.6% 1.01x (?)
StringEqualPointerComparison 2635 2670 +1.3% 0.99x (?)
StringFromLongWholeSubstring 202 203 +0.5% 1.00x (?)
StringFromLongWholeSubstringGeneric 207 206 -0.5% 1.00x (?)
StringHasPrefix 1901 1889 -0.6% 1.01x (?)
StringHasPrefixUnicode 17346 17395 +0.3% 1.00x (?)
StringHasSuffix 2018 2002 -0.8% 1.01x (?)
StringHasSuffixUnicode 63747 63912 +0.3% 1.00x (?)
StringInterpolation 13675 13295 -2.8% 1.03x
StringMatch 34666 34540 -0.4% 1.00x (?)
StringUTF16Builder 7924 7873 -0.6% 1.01x (?)
StringWalk 11534 11775 +2.1% 0.98x (?)
StringWithCString 56128 54515 -2.9% 1.03x (?)
SubstringComparable 4220 4062 -3.7% 1.04x
SubstringEqualString 6459 6370 -1.4% 1.01x (?)
SubstringEquatable 8269 8364 +1.1% 0.99x (?)
SubstringFromLongString 16 16 +0.0% 1.00x
SubstringFromLongStringGeneric 105 107 +1.9% 0.98x (?)
SuffixAnyCollection 6791 6625 -2.4% 1.03x (?)
SuffixAnyCollectionLazy 45377 46224 +1.9% 0.98x (?)
SuffixAnySeqCRangeIter 43586 44115 +1.2% 0.99x (?)
SuffixAnySeqCRangeIterLazy 44119 44680 +1.3% 0.99x (?)
SuffixAnySeqCntRange 6835 6674 -2.4% 1.02x (?)
SuffixAnySeqCntRangeLazy 6808 6560 -3.6% 1.04x (?)
SuffixAnySequence 30293 30330 +0.1% 1.00x (?)
SuffixAnySequenceLazy 30493 30646 +0.5% 1.00x (?)
SuffixArrayLazy 14580 14695 +0.8% 0.99x (?)
SuffixCountableRange 164 163 -0.6% 1.01x (?)
SuffixCountableRangeLazy 13501 13656 +1.1% 0.99x (?)
SuffixSequence 29982 29940 -0.1% 1.00x (?)
SuffixSequenceLazy 30064 29588 -1.6% 1.02x (?)
SumUsingReduce 223171 223386 +0.1% 1.00x (?)
SumUsingReduceInto 214341 216299 +0.9% 0.99x (?)
SuperChars 181277 187315 +3.3% 0.97x
TwoSum 4273 4372 +2.3% 0.98x (?)
TypeFlood 160 163 +1.9% 0.98x (?)
UTF8Decode 36511 36200 -0.9% 1.01x (?)
Walsh 12097 11796 -2.5% 1.03x (?)
XorLoop 23237 23255 +0.1% 1.00x (?)
Hardware Overview
  Model Name: Mac mini
  Model Identifier: Macmini7,1
  Processor Name: Intel Core i7
  Processor Speed: 3 GHz
  Number of Processors: 1
  Total Number of Cores: 2
  L2 Cache (per Core): 256 KB
  L3 Cache: 4 MB
  Memory: 16 GB

@airspeedswift
Copy link
Member

airspeedswift commented Oct 19, 2017

This is a neat solution for this one case, but it's a sticking plaster over the fundamental issue. More generally, ignoring the requirements of Equatable leads to bugs across the board. There's won't always be a similarly good fix for Set not de-duping properly, or sort corrupting data. A binary search that relies on == being reflexive could easily go into an infinite loop.

With conditional conformance, we are going to be able to make Array: Equatable when its elements are equatable. That will cause this problem to spread, virus-like, into Array as well:

let a: [Double] = [.nan]
let b: [[Double] = [a]
let c = b
c == a    // true
c == [a]  // false

For these reasons, I'm inclined to not take this particular fix until it's finalized that the underlying problems with FP comparison aren't going to be fixed. Otherwise, we are just perpetuating the issue.

@xwu
Copy link
Collaborator Author

xwu commented Oct 19, 2017

@airspeedswift I understand the desire to solve this definitively. This PR, however, is a strict improvement over the status quo and—as I have argued—essentially orthogonal to the floating point issue in the sense that consistent behavior for Array.== can be accommodated regardless of the behavior of FloatingPoint.==.

Believe it or not, a similarly terse fix exists for all generic algorithms vended by the standard library. This is one of a series of incremental steps that can indeed fix the issue of Set deduping and sort corruption. The conditional conformance of Array to Equatable is accommodated by having _containsExceptionalValues return Element._containsExceptionalValues and requires no explosion of code.

@airspeedswift
Copy link
Member

Yes, we can fix issues within the Standard Library on a case-by-case basis by adding underscored methods. The std lib is privileged in that it can add dynamically dispatched customization points as needed. But the algorithms in the std lib shouldn't be special, user code can get bitten by this just as easily.

Also, bear in mind that as we venture into ABI-stable territory, these custom workarounds become permanent and less able to be backed out in future versions.

@airspeedswift
Copy link
Member

We should probably have this discussion on swift-dev rather than the PR...

@xwu
Copy link
Collaborator Author

xwu commented Oct 19, 2017

Agree. Let's move the overarching discussion to swift-dev.

Suffice it to say, though, that the intention is not to leave these underscored permanently. Either == remains as it is today and these methods will need to become public additions to the design of Equatable after proving their usability as underscored methods (and with some nicer names), or Equatable needs to be redesigned and these underscored methods will be wiped away. In either case, I see it as a step in the right direction.

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.

None yet

4 participants