Skip to content

[stdlib] Set, Dictionary: Clarify assert message when a duplicate key is found #15569

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
Mar 28, 2018

Conversation

lorentey
Copy link
Member

When a duplicate key is found during rehashing, it is usually either because a key was mutated after insertion, or because the dictionary itself was mutated from multiple threads at the same time.

Both of these are serious programmer errors. Promote the sanity check for duplicate keys to a full precondition and improve the error message to point out the most probable cause of the failure.

… is found

When a duplicate key is found during rehashing, it is usually either because a key was mutated after insertion, or because the dictionary itself was mutated from multiple threads at the same time.

Both of these are serious programmer errors. Promote the sanity check for duplicate keys to a full precondition and improve the error message to point out the most probable cause of the failure.
@lorentey
Copy link
Member Author

@swift-ci test

@lorentey
Copy link
Member Author

@swift-ci smoke benchmark

@lorentey lorentey requested review from lancep and milseman March 28, 2018 11:07
@lorentey
Copy link
Member Author

This is just a quick patch to help people debug these issues. We aren't doing a great job at detecting them, though; we should try to catch them more often. (rdar://problem/36437535)

@swift-ci
Copy link
Contributor

Build comment file:

Optimized (O)

Regression (21)
TEST OLD NEW DELTA SPEEDUP
Sim2DArray 417 668 +60.2% 0.62x
StringBuilderLong 1190 1649 +38.6% 0.72x
ArrayPlusEqualFiveElementCollection 6497 8671 +33.5% 0.75x
CharIteration_utf16_unicodeScalars_Backwards 17714 19515 +10.2% 0.91x
ObjectiveCBridgeStubFromArrayOfNSString 30760 33620 +9.3% 0.91x (?)
CharIndexing_ascii_unicodeScalars 15554 16972 +9.1% 0.92x
CharIndexing_japanese_unicodeScalars 18626 20312 +9.1% 0.92x
CharIndexing_russian_unicodeScalars 12961 14133 +9.0% 0.92x
CharIndexing_korean_unicodeScalars 15095 16455 +9.0% 0.92x
CharIndexing_chinese_unicodeScalars 11792 12843 +8.9% 0.92x
CharIndexing_tweet_unicodeScalars 30642 33083 +8.0% 0.93x
CharIndexing_punctuated_unicodeScalars 3549 3827 +7.8% 0.93x
CharIndexing_punctuatedJapanese_unicodeScalars 2838 3057 +7.7% 0.93x
Chars 974 1036 +6.4% 0.94x
NSDictionaryCastToSwift 5313 5613 +5.6% 0.95x (?)
CharIteration_tweet_unicodeScalars_Backwards 29142 30765 +5.6% 0.95x
CharIteration_ascii_unicodeScalars_Backwards 14757 15576 +5.5% 0.95x
CharIteration_japanese_unicodeScalars_Backwards 17687 18661 +5.5% 0.95x
CharIteration_chinese_unicodeScalars_Backwards 11191 11794 +5.4% 0.95x
CharIteration_korean_unicodeScalars_Backwards 14338 15106 +5.4% 0.95x
CharIteration_russian_unicodeScalars_Backwards 12321 12975 +5.3% 0.95x
Improvement (15)
TEST OLD NEW DELTA SPEEDUP
BinaryFloatingPointPropertiesBinade 31 25 -19.4% 1.24x
RangeIterationSigned 200 171 -14.5% 1.17x
ChainedFilterMap 1409 1248 -11.4% 1.13x
StaticArray 10 9 -10.0% 1.11x (?)
StringEdits 162618 147418 -9.3% 1.10x (?)
StringEqualPointerComparison 315 286 -9.2% 1.10x
DropLastCountableRangeLazy 12 11 -8.3% 1.09x
BinaryFloatingPointConversionFromBinaryInteger 40 37 -7.5% 1.08x
StringBuilderWithLongSubstring 1444 1336 -7.5% 1.08x (?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 5255 4923 -6.3% 1.07x (?)
ByteSwap 108 102 -5.6% 1.06x
BinaryFloatingPointPropertiesUlp 37 35 -5.4% 1.06x
BitCount 211 200 -5.2% 1.05x
StringWithCString 43016 40774 -5.2% 1.05x
ObjectiveCBridgeFromNSSetAnyObject 49261 46901 -4.8% 1.05x (?)
No Changes (389)
TEST OLD NEW DELTA SPEEDUP
AngryPhonebook 3525 3543 +0.5% 0.99x (?)
AnyHashableWithAClass 82225 82346 +0.1% 1.00x (?)
Array2D 2547 2548 +0.0% 1.00x (?)
ArrayAppend 1086 1110 +2.2% 0.98x
ArrayAppendArrayOfInt 781 795 +1.8% 0.98x (?)
ArrayAppendAscii 13321 13102 -1.6% 1.02x
ArrayAppendFromGeneric 790 796 +0.8% 0.99x (?)
ArrayAppendGenericStructs 1428 1428 +0.0% 1.00x
ArrayAppendLatin1 37669 37341 -0.9% 1.01x
ArrayAppendLazyMap 1348 1345 -0.2% 1.00x
ArrayAppendOptionals 1428 1428 +0.0% 1.00x
ArrayAppendRepeatCol 1340 1347 +0.5% 0.99x
ArrayAppendReserved 817 841 +2.9% 0.97x
ArrayAppendSequence 1121 1119 -0.2% 1.00x (?)
ArrayAppendStrings 15242 15243 +0.0% 1.00x (?)
ArrayAppendToFromGeneric 793 800 +0.9% 0.99x
ArrayAppendToGeneric 798 799 +0.1% 1.00x (?)
ArrayAppendUTF16 36950 37143 +0.5% 0.99x
ArrayInClass 86 86 +0.0% 1.00x
ArrayLiteral 0 0 +0.0% 1.00x
ArrayOfGenericPOD2 151 149 -1.3% 1.01x
ArrayOfGenericRef 4408 4357 -1.2% 1.01x (?)
ArrayOfPOD 183 184 +0.5% 0.99x
ArrayOfRef 4370 4363 -0.2% 1.00x (?)
ArrayPlusEqualArrayOfInt 806 794 -1.5% 1.02x
ArrayPlusEqualSingleElementCollection 4885 4891 +0.1% 1.00x
ArrayPlusEqualThreeElements 2017 2014 -0.1% 1.00x (?)
ArraySubscript 1523 1512 -0.7% 1.01x (?)
ArrayValueProp 8 8 +0.0% 1.00x
ArrayValueProp2 8 8 +0.0% 1.00x
ArrayValueProp3 8 8 +0.0% 1.00x
ArrayValueProp4 8 8 +0.0% 1.00x
BinaryFloatingPointPropertiesNextUp 28 28 +0.0% 1.00x
COWTree 5596 5519 -1.4% 1.01x (?)
CSVParsing 757561 760650 +0.4% 1.00x (?)
CSVParsingAlt 725126 728101 +0.4% 1.00x
CSVParsingAltIndices 341815 338572 -0.9% 1.01x (?)
CStringLongAscii 4748 4757 +0.2% 1.00x (?)
CStringLongNonAscii 2285 2364 +3.5% 0.97x
CStringShortAscii 5507 5517 +0.2% 1.00x (?)
Calculator 682 675 -1.0% 1.01x
CaptureProp 4097 4119 +0.5% 0.99x (?)
CharIndexing_ascii_unicodeScalars_Backwards 15787 15651 -0.9% 1.01x
CharIndexing_chinese_unicodeScalars_Backwards 11975 11855 -1.0% 1.01x
CharIndexing_japanese_unicodeScalars_Backwards 18917 18743 -0.9% 1.01x
CharIndexing_korean_unicodeScalars_Backwards 15321 15177 -0.9% 1.01x
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 2857 2827 -1.1% 1.01x
CharIndexing_punctuated_unicodeScalars_Backwards 3577 3540 -1.0% 1.01x
CharIndexing_russian_unicodeScalars_Backwards 13160 13046 -0.9% 1.01x
CharIndexing_tweet_unicodeScalars_Backwards 31225 30837 -1.2% 1.01x
CharIndexing_utf16_unicodeScalars 21147 21639 +2.3% 0.98x
CharIndexing_utf16_unicodeScalars_Backwards 21518 21550 +0.1% 1.00x
CharIteration_ascii_unicodeScalars 21277 20496 -3.7% 1.04x
CharIteration_chinese_unicodeScalars 16109 15532 -3.6% 1.04x
CharIteration_japanese_unicodeScalars 25459 24539 -3.6% 1.04x
CharIteration_korean_unicodeScalars 20650 19891 -3.7% 1.04x
CharIteration_punctuatedJapanese_unicodeScalars 3821 3736 -2.2% 1.02x
CharIteration_punctuatedJapanese_unicodeScalars_Backwards 2680 2814 +5.0% 0.95x
CharIteration_punctuated_unicodeScalars 4787 4657 -2.7% 1.03x
CharIteration_punctuated_unicodeScalars_Backwards 3354 3525 +5.1% 0.95x
CharIteration_russian_unicodeScalars 17721 17178 -3.1% 1.03x
CharIteration_tweet_unicodeScalars 41912 40652 -3.0% 1.03x
CharIteration_utf16_unicodeScalars 27950 27743 -0.7% 1.01x
CharacterLiteralsLarge 5712 5759 +0.8% 0.99x
CharacterLiteralsSmall 217 220 +1.4% 0.99x
CharacterPropertiesFetch 4668 4579 -1.9% 1.02x
CharacterPropertiesPrecomputed 1297 1274 -1.8% 1.02x (?)
CharacterPropertiesStashed 1438 1458 +1.4% 0.99x (?)
CharacterPropertiesStashedMemo 1711 1707 -0.2% 1.00x (?)
ClassArrayGetter 15 15 +0.0% 1.00x
Combos 464 464 +0.0% 1.00x
DataAccessBytes 1143 1149 +0.5% 0.99x (?)
DataAppendArray 6350 6286 -1.0% 1.01x (?)
DataAppendBytes 6449 6464 +0.2% 1.00x (?)
DataAppendDataLargeToLarge 70944 71201 +0.4% 1.00x (?)
DataAppendDataLargeToMedium 37208 36993 -0.6% 1.01x (?)
DataAppendDataLargeToSmall 35706 35607 -0.3% 1.00x (?)
DataAppendDataMediumToLarge 39458 39048 -1.0% 1.01x (?)
DataAppendDataMediumToMedium 8484 8301 -2.2% 1.02x (?)
DataAppendDataMediumToSmall 7246 7002 -3.4% 1.03x (?)
DataAppendDataSmallToLarge 38439 38702 +0.7% 0.99x (?)
DataAppendDataSmallToMedium 7814 7613 -2.6% 1.03x
DataAppendDataSmallToSmall 7275 6953 -4.4% 1.05x (?)
DataAppendSequence 19919 19039 -4.4% 1.05x (?)
DataCopyBytes 2505 2488 -0.7% 1.01x (?)
DataCount 38 37 -2.6% 1.03x
DataMutateBytes 4312 4335 +0.5% 0.99x (?)
DataReplaceLarge 43265 44192 +2.1% 0.98x
DataReplaceLargeBuffer 59728 58881 -1.4% 1.01x (?)
DataReplaceMedium 12558 12208 -2.8% 1.03x (?)
DataReplaceMediumBuffer 13275 13788 +3.9% 0.96x (?)
DataReplaceSmall 9021 9146 +1.4% 0.99x (?)
DataReplaceSmallBuffer 9465 9570 +1.1% 0.99x (?)
DataReset 3263 3262 -0.0% 1.00x (?)
DataSetCount 905 921 +1.8% 0.98x
DataSubscript 237 246 +3.8% 0.96x
DictOfArraysToArrayOfDicts 837 855 +2.2% 0.98x (?)
Dictionary 762 748 -1.8% 1.02x
Dictionary2 1848 1842 -0.3% 1.00x
Dictionary2OfObjects 3432 3390 -1.2% 1.01x
Dictionary3 438 433 -1.1% 1.01x
Dictionary3OfObjects 905 891 -1.5% 1.02x (?)
Dictionary4 820 841 +2.6% 0.98x
Dictionary4OfObjects 939 940 +0.1% 1.00x
DictionaryBridge 2035 2025 -0.5% 1.00x (?)
DictionaryCopy 121068 120177 -0.7% 1.01x
DictionaryFilter 121491 118663 -2.3% 1.02x
DictionaryGroup 269 270 +0.4% 1.00x (?)
DictionaryGroupOfObjects 2112 2106 -0.3% 1.00x (?)
DictionaryLiteral 2087 2110 +1.1% 0.99x (?)
DictionaryOfObjects 2655 2660 +0.2% 1.00x (?)
DictionaryRemove 5292 5245 -0.9% 1.01x
DictionaryRemoveOfObjects 28726 28491 -0.8% 1.01x (?)
DictionarySubscriptDefaultMutation 337 338 +0.3% 1.00x
DictionarySubscriptDefaultMutationArray 678 674 -0.6% 1.01x (?)
DictionarySubscriptDefaultMutationArrayOfObjects 4195 4251 +1.3% 0.99x (?)
DictionarySubscriptDefaultMutationOfObjects 1968 1938 -1.5% 1.02x
DictionarySwap 1426 1420 -0.4% 1.00x (?)
DictionarySwapAt 6958 6972 +0.2% 1.00x (?)
DictionarySwapAtOfObjects 54100 53558 -1.0% 1.01x
DictionarySwapOfObjects 9556 9487 -0.7% 1.01x (?)
DoubleWidthDivision 0 0 +0.0% 1.00x
DropFirstAnyCollection 84 84 +0.0% 1.00x
DropFirstAnyCollectionLazy 67008 67095 +0.1% 1.00x (?)
DropFirstAnySeqCRangeIter 20391 20184 -1.0% 1.01x
DropFirstAnySeqCRangeIterLazy 20427 20201 -1.1% 1.01x
DropFirstAnySeqCntRange 28 29 +3.6% 0.97x
DropFirstAnySeqCntRangeLazy 28 29 +3.6% 0.97x
DropFirstAnySequence 5093 5076 -0.3% 1.00x
DropFirstAnySequenceLazy 5096 5064 -0.6% 1.01x
DropFirstArray 35 35 +0.0% 1.00x
DropFirstArrayLazy 35 35 +0.0% 1.00x
DropFirstCountableRange 35 35 +0.0% 1.00x
DropFirstCountableRangeLazy 35 35 +0.0% 1.00x
DropFirstSequence 2682 2683 +0.0% 1.00x (?)
DropFirstSequenceLazy 2769 2769 +0.0% 1.00x
DropLastAnyCollection 31 31 +0.0% 1.00x
DropLastAnyCollectionLazy 22182 22386 +0.9% 0.99x (?)
DropLastAnySeqCRangeIter 3626 3649 +0.6% 0.99x (?)
DropLastAnySeqCRangeIterLazy 3631 3635 +0.1% 1.00x (?)
DropLastAnySeqCntRange 14 14 +0.0% 1.00x
DropLastAnySeqCntRangeLazy 13 13 +0.0% 1.00x
DropLastAnySequence 4967 5015 +1.0% 0.99x (?)
DropLastAnySequenceLazy 5088 5091 +0.1% 1.00x (?)
DropLastCountableRange 11 11 +0.0% 1.00x
DropLastSequence 657 658 +0.2% 1.00x
DropLastSequenceLazy 656 656 +0.0% 1.00x
DropWhileAnyCollection 109 108 -0.9% 1.01x
DropWhileAnyCollectionLazy 125 125 +0.0% 1.00x
DropWhileAnySeqCRangeIter 16150 16049 -0.6% 1.01x
DropWhileAnySeqCRangeIterLazy 90 90 +0.0% 1.00x
DropWhileAnySeqCntRange 36 36 +0.0% 1.00x
DropWhileAnySeqCntRangeLazy 90 90 +0.0% 1.00x
DropWhileAnySequence 4927 4950 +0.5% 1.00x
DropWhileAnySequenceLazy 1855 1856 +0.1% 1.00x (?)
DropWhileArrayLazy 88 88 +0.0% 1.00x
DropWhileCountableRange 35 35 +0.0% 1.00x
DropWhileCountableRangeLazy 105 105 +0.0% 1.00x
DropWhileSequence 1326 1326 +0.0% 1.00x
DropWhileSequenceLazy 88 88 +0.0% 1.00x
EqualStringSubstring 47 47 +0.0% 1.00x
EqualSubstringString 47 47 +0.0% 1.00x
EqualSubstringSubstring 47 47 +0.0% 1.00x
EqualSubstringSubstringGenericEquatable 47 47 +0.0% 1.00x
ErrorHandling 2475 2450 -1.0% 1.01x (?)
ExclusivityGlobal 5 5 +0.0% 1.00x
ExclusivityIndependent 2 2 +0.0% 1.00x
FatCompactMap 205003 204396 -0.3% 1.00x
FilterEvenUsingReduce 1320 1316 -0.3% 1.00x (?)
FilterEvenUsingReduceInto 148 146 -1.4% 1.01x (?)
FloatingPointPrinting_Double_description_small 80356 81733 +1.7% 0.98x
FloatingPointPrinting_Double_description_uniform 135609 137675 +1.5% 0.98x
FloatingPointPrinting_Double_interpolated 184751 181692 -1.7% 1.02x
FloatingPointPrinting_Float80_description_small 92057 95589 +3.8% 0.96x
FloatingPointPrinting_Float80_description_uniform 1702893 1705954 +0.2% 1.00x
FloatingPointPrinting_Float80_interpolated 1748899 1748718 -0.0% 1.00x (?)
FloatingPointPrinting_Float_description_small 41848 42884 +2.5% 0.98x
FloatingPointPrinting_Float_description_uniform 44500 46060 +3.5% 0.97x
FloatingPointPrinting_Float_interpolated 86611 85864 -0.9% 1.01x (?)
FrequenciesUsingReduce 7253 7085 -2.3% 1.02x (?)
FrequenciesUsingReduceInto 3737 3739 +0.1% 1.00x (?)
Hanoi 2093 2087 -0.3% 1.00x (?)
HashTest 1783 1772 -0.6% 1.01x
Histogram 873 872 -0.1% 1.00x (?)
Integrate 335 337 +0.6% 0.99x (?)
IterateData 1830 1830 +0.0% 1.00x
Join 349 346 -0.9% 1.01x (?)
LazilyFilteredArrayContains 36297 36294 -0.0% 1.00x (?)
LazilyFilteredArrays 65068 64918 -0.2% 1.00x (?)
LazilyFilteredRange 3888 3884 -0.1% 1.00x (?)
LessSubstringSubstring 47 47 +0.0% 1.00x
LessSubstringSubstringGenericComparable 47 47 +0.0% 1.00x
LinkedList 7546 7542 -0.1% 1.00x (?)
LuhnAlgoEager 539 532 -1.3% 1.01x
LuhnAlgoLazy 536 536 +0.0% 1.00x
MapReduce 371 370 -0.3% 1.00x (?)
MapReduceAnyCollection 431 432 +0.2% 1.00x (?)
MapReduceAnyCollectionShort 2258 2241 -0.8% 1.01x (?)
MapReduceClass 3017 3018 +0.0% 1.00x (?)
MapReduceClassShort 4594 4596 +0.0% 1.00x (?)
MapReduceLazyCollection 13 13 +0.0% 1.00x
MapReduceLazyCollectionShort 34 34 +0.0% 1.00x
MapReduceLazySequence 86 86 +0.0% 1.00x
MapReduceSequence 435 444 +2.1% 0.98x (?)
MapReduceShort 2003 2005 +0.1% 1.00x (?)
MapReduceShortString 21 21 +0.0% 1.00x
MapReduceString 77 77 +0.0% 1.00x
Memset 222 219 -1.4% 1.01x (?)
MonteCarloE 10180 10209 +0.3% 1.00x
MonteCarloPi 42732 42782 +0.1% 1.00x
NSError 305 301 -1.3% 1.01x (?)
NSStringConversion 389 390 +0.3% 1.00x
NibbleSort 3685 3685 +0.0% 1.00x
NopDeinit 30162 30169 +0.0% 1.00x (?)
ObjectAllocation 133 133 +0.0% 1.00x
ObjectiveCBridgeFromNSArrayAnyObject 24450 24654 +0.8% 0.99x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 43547 44179 +1.5% 0.99x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 42522 41989 -1.3% 1.01x (?)
ObjectiveCBridgeFromNSDictionaryAnyObject 104057 105835 +1.7% 0.98x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 4114 4260 +3.5% 0.97x (?)
ObjectiveCBridgeFromNSSetAnyObjectToString 80217 79657 -0.7% 1.01x (?)
ObjectiveCBridgeFromNSString 1377 1331 -3.3% 1.03x (?)
ObjectiveCBridgeFromNSStringForced 2550 2439 -4.4% 1.05x (?)
ObjectiveCBridgeStubDataAppend 11551 11502 -0.4% 1.00x (?)
ObjectiveCBridgeStubDateMutation 400 400 +0.0% 1.00x
ObjectiveCBridgeStubFromNSDate 7210 7272 +0.9% 0.99x (?)
ObjectiveCBridgeStubFromNSString 933 947 +1.5% 0.99x
ObjectiveCBridgeStubFromNSStringRef 155 156 +0.6% 0.99x
ObjectiveCBridgeStubNSDataAppend 2634 2645 +0.4% 1.00x
ObjectiveCBridgeStubNSDateMutationRef 13710 13801 +0.7% 0.99x (?)
ObjectiveCBridgeStubToArrayOfNSString 27858 27791 -0.2% 1.00x (?)
ObjectiveCBridgeStubToNSDate 15178 15654 +3.1% 0.97x (?)
ObjectiveCBridgeStubToNSDateRef 3414 3468 +1.6% 0.98x (?)
ObjectiveCBridgeStubToNSString 1521 1529 +0.5% 0.99x (?)
ObjectiveCBridgeStubToNSStringRef 115 116 +0.9% 0.99x (?)
ObjectiveCBridgeStubURLAppendPath 359985 350189 -2.7% 1.03x (?)
ObjectiveCBridgeStubURLAppendPathRef 352500 348999 -1.0% 1.01x (?)
ObjectiveCBridgeToNSArray 28444 28648 +0.7% 0.99x (?)
ObjectiveCBridgeToNSDictionary 41962 42185 +0.5% 0.99x (?)
ObjectiveCBridgeToNSSet 32971 33746 +2.4% 0.98x (?)
ObjectiveCBridgeToNSString 1298 1301 +0.2% 1.00x (?)
ObserverClosure 2160 2166 +0.3% 1.00x (?)
ObserverForwarderStruct 1250 1255 +0.4% 1.00x (?)
ObserverPartiallyAppliedMethod 3756 3769 +0.3% 1.00x
ObserverUnappliedMethod 2595 2589 -0.2% 1.00x (?)
OpenClose 123 123 +0.0% 1.00x
PartialApplyDynamicType 0 0 +0.0% 1.00x
Phonebook 3824 3841 +0.4% 1.00x
PointerArithmetics 31490 31518 +0.1% 1.00x
PolymorphicCalls 25 25 +0.0% 1.00x
PopFrontArray 1867 1875 +0.4% 1.00x (?)
PopFrontArrayGeneric 1906 1893 -0.7% 1.01x
PopFrontUnsafePointer 8654 9088 +5.0% 0.95x
PrefixAnyCollection 84 83 -1.2% 1.01x
PrefixAnyCollectionLazy 67138 67028 -0.2% 1.00x (?)
PrefixAnySeqCRangeIter 15999 15954 -0.3% 1.00x (?)
PrefixAnySeqCRangeIterLazy 16002 15948 -0.3% 1.00x
PrefixAnySeqCntRange 28 29 +3.6% 0.97x
PrefixAnySeqCntRangeLazy 29 28 -3.4% 1.04x
PrefixAnySequence 4418 4411 -0.2% 1.00x
PrefixAnySequenceLazy 4417 4407 -0.2% 1.00x
PrefixArray 35 35 +0.0% 1.00x
PrefixArrayLazy 35 35 +0.0% 1.00x
PrefixCountableRange 35 35 +0.0% 1.00x
PrefixCountableRangeLazy 35 35 +0.0% 1.00x
PrefixSequence 1325 1326 +0.1% 1.00x (?)
PrefixSequenceLazy 1414 1414 +0.0% 1.00x
PrefixWhileAnyCollection 154 155 +0.6% 0.99x
PrefixWhileAnyCollectionLazy 90 90 +0.0% 1.00x
PrefixWhileAnySeqCRangeIter 9107 9154 +0.5% 0.99x (?)
PrefixWhileAnySeqCRangeIterLazy 24 24 +0.0% 1.00x
PrefixWhileAnySeqCntRange 60 60 +0.0% 1.00x
PrefixWhileAnySeqCntRangeLazy 24 24 +0.0% 1.00x
PrefixWhileAnySequence 10260 10265 +0.0% 1.00x (?)
PrefixWhileAnySequenceLazy 1393 1394 +0.1% 1.00x
PrefixWhileArray 88 88 +0.0% 1.00x
PrefixWhileArrayLazy 70 70 +0.0% 1.00x
PrefixWhileCountableRange 35 35 +0.0% 1.00x
PrefixWhileCountableRangeLazy 35 35 +0.0% 1.00x
PrefixWhileSequence 363 362 -0.3% 1.00x (?)
PrefixWhileSequenceLazy 52 52 +0.0% 1.00x
Prims 1164 1194 +2.6% 0.97x (?)
PrimsSplit 1164 1159 -0.4% 1.00x
QueueConcrete 1134 1135 +0.1% 1.00x (?)
QueueGeneric 1137 1140 +0.3% 1.00x (?)
RC4 164 164 +0.0% 1.00x
RGBHistogram 3889 3885 -0.1% 1.00x (?)
RGBHistogramOfObjects 25397 25303 -0.4% 1.00x (?)
RangeAssignment 353 338 -4.2% 1.04x
RangeIterationSigned64 200 200 +0.0% 1.00x
RangeIterationUnsigned 200 200 +0.0% 1.00x
RangeReplaceableCollectionPlusDefault 910 905 -0.5% 1.01x (?)
RecursiveOwnedParameter 115 115 +0.0% 1.00x
RemoveWhereFilterInts 43 43 +0.0% 1.00x
RemoveWhereFilterString 378 376 -0.5% 1.01x
RemoveWhereFilterStrings 433 433 +0.0% 1.00x
RemoveWhereMoveInts 15 15 +0.0% 1.00x
RemoveWhereMoveStrings 702 702 +0.0% 1.00x
RemoveWhereQuadraticInts 1292 1290 -0.2% 1.00x
RemoveWhereQuadraticString 494 490 -0.8% 1.01x (?)
RemoveWhereQuadraticStrings 2753 2754 +0.0% 1.00x (?)
RemoveWhereSwapInts 19 19 +0.0% 1.00x
RemoveWhereSwapStrings 849 850 +0.1% 1.00x (?)
ReversedArray 57 57 +0.0% 1.00x
ReversedBidirectional 16221 16200 -0.1% 1.00x (?)
ReversedDictionary 339 334 -1.5% 1.01x (?)
RomanNumbers 147558 147790 +0.2% 1.00x (?)
SequenceAlgosAnySequence 11198 11211 +0.1% 1.00x (?)
SequenceAlgosArray 1578 1578 +0.0% 1.00x
SequenceAlgosContiguousArray 1576 1575 -0.1% 1.00x (?)
SequenceAlgosList 1350 1350 +0.0% 1.00x
SequenceAlgosRange 2577 2577 +0.0% 1.00x
SequenceAlgosUnfoldSequence 1080 1080 +0.0% 1.00x
SetExclusiveOr 6560 6554 -0.1% 1.00x (?)
SetExclusiveOr_OfObjects 13605 13587 -0.1% 1.00x (?)
SetIntersect 993 993 +0.0% 1.00x
SetIntersect_OfObjects 2272 2271 -0.0% 1.00x (?)
SetIsSubsetOf 382 381 -0.3% 1.00x (?)
SetIsSubsetOf_OfObjects 527 528 +0.2% 1.00x
SetUnion 5523 5521 -0.0% 1.00x (?)
SetUnion_OfObjects 11957 12203 +2.1% 0.98x (?)
SevenBoom 1528 1507 -1.4% 1.01x (?)
SortLargeExistentials 5560 5473 -1.6% 1.02x
SortLettersInPlace 1001 1000 -0.1% 1.00x (?)
SortSortedStrings 804 806 +0.2% 1.00x (?)
SortStrings 1585 1583 -0.1% 1.00x
SortStringsUnicode 2360 2291 -2.9% 1.03x
StackPromo 22699 22670 -0.1% 1.00x
StrComplexWalk 1564 1562 -0.1% 1.00x
StrToInt 1525 1462 -4.1% 1.04x
StringAdder 4211 4212 +0.0% 1.00x (?)
StringBuilder 1604 1596 -0.5% 1.01x (?)
StringComparison_abnormal 787 784 -0.4% 1.00x (?)
StringComparison_ascii 850 880 +3.5% 0.97x
StringComparison_emoji 799 785 -1.8% 1.02x (?)
StringComparison_fastPrenormal 678 689 +1.6% 0.98x
StringComparison_latin1 528 531 +0.6% 0.99x
StringComparison_longSharedPrefix 882 883 +0.1% 1.00x (?)
StringComparison_nonBMPSlowestPrenormal 1566 1540 -1.7% 1.02x
StringComparison_slowerPrenormal 1658 1647 -0.7% 1.01x
StringComparison_zalgo 123992 124640 +0.5% 0.99x (?)
StringEnumRawValueInitialization 1017 1018 +0.1% 1.00x (?)
StringFromLongWholeSubstring 21 21 +0.0% 1.00x
StringFromLongWholeSubstringGeneric 99 97 -2.0% 1.02x
StringHasPrefixAscii 1718 1719 +0.1% 1.00x (?)
StringHasPrefixUnicode 108842 109548 +0.6% 0.99x
StringHasSuffixAscii 1833 1860 +1.5% 0.99x
StringHasSuffixUnicode 112476 111469 -0.9% 1.01x (?)
StringInterpolation 10268 10515 +2.4% 0.98x (?)
StringInterpolationManySmallSegments 21402 21561 +0.7% 0.99x (?)
StringInterpolationSmall 8552 8641 +1.0% 0.99x (?)
StringMatch 9343 9301 -0.4% 1.00x
StringRemoveDupes 1413 1404 -0.6% 1.01x (?)
StringUTF16Builder 2500 2536 +1.4% 0.99x (?)
StringUTF16SubstringBuilder 5331 5322 -0.2% 1.00x (?)
StringWalk 1413 1397 -1.1% 1.01x
StringWordBuilder 2391 2509 +4.9% 0.95x
StringWordBuilderReservingCapacity 2076 2176 +4.8% 0.95x
SubstringComparable 27 27 +0.0% 1.00x
SubstringEqualString 532 525 -1.3% 1.01x (?)
SubstringEquatable 1341 1333 -0.6% 1.01x
SubstringFromLongString 10 10 +0.0% 1.00x
SubstringFromLongStringGeneric 74 75 +1.4% 0.99x
SuffixAnyCollection 30 31 +3.3% 0.97x
SuffixAnyCollectionLazy 22093 22354 +1.2% 0.99x (?)
SuffixAnySeqCRangeIter 3848 3863 +0.4% 1.00x (?)
SuffixAnySeqCRangeIterLazy 3848 3904 +1.5% 0.99x
SuffixAnySeqCntRange 21 21 +0.0% 1.00x
SuffixAnySeqCntRangeLazy 21 21 +0.0% 1.00x
SuffixAnySequence 4998 5000 +0.0% 1.00x (?)
SuffixAnySequenceLazy 5085 5102 +0.3% 1.00x
SuffixCountableRange 11 11 +0.0% 1.00x
SuffixCountableRangeLazy 11 11 +0.0% 1.00x
SuffixSequence 3693 3712 +0.5% 0.99x
SuffixSequenceLazy 3677 3720 +1.2% 0.99x
SumUsingReduce 98 102 +4.1% 0.96x
SumUsingReduceInto 101 97 -4.0% 1.04x
SuperChars 41502 40119 -3.3% 1.03x
TwoSum 1708 1689 -1.1% 1.01x
TypeFlood 0 0 +0.0% 1.00x
UTF8Decode 293 296 +1.0% 0.99x
Walsh 415 406 -2.2% 1.02x
WordCountHistogramASCII 7385 7342 -0.6% 1.01x (?)
WordCountHistogramUTF16 13700 13740 +0.3% 1.00x (?)
WordCountUniqueASCII 2665 2709 +1.7% 0.98x (?)
WordCountUniqueUTF16 7276 7326 +0.7% 0.99x (?)
WordSplitASCII 19850 19947 +0.5% 1.00x (?)
WordSplitUTF16 22302 21842 -2.1% 1.02x (?)
XorLoop 395 395 +0.0% 1.00x

Unoptimized (Onone)

Regression (16)
TEST OLD NEW DELTA SPEEDUP
SubstringEqualString 1684 1973 +17.2% 0.85x (?)
PrefixWhileAnySeqCntRangeLazy 17670 20327 +15.0% 0.87x
FloatingPointPrinting_Float_description_uniform 58355 66052 +13.2% 0.88x
FloatingPointPrinting_Float_interpolated 139909 153196 +9.5% 0.91x
CharIndexing_tweet_unicodeScalars 636332 695868 +9.4% 0.91x (?)
StringWordBuilder 2410 2618 +8.6% 0.92x
StringWordBuilderReservingCapacity 2091 2265 +8.3% 0.92x
DataReplaceMediumBuffer 11752 12713 +8.2% 0.92x (?)
StringUTF16SubstringBuilder 21383 23063 +7.9% 0.93x
CharIteration_tweet_unicodeScalars_Backwards 585633 630501 +7.7% 0.93x (?)
CharIndexing_korean_unicodeScalars 317828 341788 +7.5% 0.93x
WordSplitASCII 23086 24807 +7.5% 0.93x (?)
RangeIterationSigned64 39286 41942 +6.8% 0.94x
CharIndexing_ascii_unicodeScalars 326798 348316 +6.6% 0.94x
CharIndexing_chinese_unicodeScalars 243992 259951 +6.5% 0.94x
DataAppendDataSmallToMedium 6097 6421 +5.3% 0.95x
Improvement (17)
TEST OLD NEW DELTA SPEEDUP
ObjectiveCBridgeStubToNSDate 21117 16248 -23.1% 1.30x
DropFirstArrayLazy 32377 28676 -11.4% 1.13x
PrefixArrayLazy 32350 28689 -11.3% 1.13x
PrefixCountableRangeLazy 45399 41086 -9.5% 1.10x
RemoveWhereQuadraticString 2495 2272 -8.9% 1.10x
RangeIterationUnsigned 39255 35821 -8.7% 1.10x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 45907 42458 -7.5% 1.08x (?)
ArrayPlusEqualThreeElements 10176 9418 -7.4% 1.08x
ObjectiveCBridgeStubFromArrayOfNSString 34762 32438 -6.7% 1.07x (?)
PrefixAnyCollectionLazy 119708 111986 -6.5% 1.07x
FrequenciesUsingReduceInto 5880 5525 -6.0% 1.06x (?)
DropLastCountableRangeLazy 14486 13619 -6.0% 1.06x (?)
SuffixCountableRangeLazy 14512 13671 -5.8% 1.06x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 52457 49857 -5.0% 1.05x (?)
NSError 770 732 -4.9% 1.05x (?)
DataAppendDataMediumToMedium 7402 7040 -4.9% 1.05x
StringComparison_ascii 9923 9443 -4.8% 1.05x
No Changes (392)
TEST OLD NEW DELTA SPEEDUP
AngryPhonebook 5142 5171 +0.6% 0.99x (?)
AnyHashableWithAClass 100063 99503 -0.6% 1.01x (?)
Array2D 633211 634392 +0.2% 1.00x (?)
ArrayAppend 4444 4444 +0.0% 1.00x
ArrayAppendArrayOfInt 869 850 -2.2% 1.02x
ArrayAppendAscii 39266 39268 +0.0% 1.00x (?)
ArrayAppendFromGeneric 876 873 -0.3% 1.00x (?)
ArrayAppendGenericStructs 1492 1501 +0.6% 0.99x (?)
ArrayAppendLatin1 64299 63742 -0.9% 1.01x
ArrayAppendLazyMap 169977 172839 +1.7% 0.98x
ArrayAppendOptionals 1505 1506 +0.1% 1.00x (?)
ArrayAppendRepeatCol 173805 175897 +1.2% 0.99x
ArrayAppendReserved 4051 4053 +0.0% 1.00x (?)
ArrayAppendSequence 101764 101766 +0.0% 1.00x (?)
ArrayAppendStrings 15417 15382 -0.2% 1.00x (?)
ArrayAppendToFromGeneric 871 866 -0.6% 1.01x (?)
ArrayAppendToGeneric 877 875 -0.2% 1.00x (?)
ArrayAppendUTF16 62926 63077 +0.2% 1.00x (?)
ArrayInClass 6922 6910 -0.2% 1.00x (?)
ArrayLiteral 1825 1823 -0.1% 1.00x (?)
ArrayOfGenericPOD2 1185 1187 +0.2% 1.00x
ArrayOfGenericRef 10892 10781 -1.0% 1.01x (?)
ArrayOfPOD 845 846 +0.1% 1.00x
ArrayOfRef 9849 9871 +0.2% 1.00x (?)
ArrayPlusEqualArrayOfInt 869 864 -0.6% 1.01x (?)
ArrayPlusEqualFiveElementCollection 242386 247527 +2.1% 0.98x
ArrayPlusEqualSingleElementCollection 236336 235005 -0.6% 1.01x (?)
ArraySubscript 106258 107804 +1.5% 0.99x
ArrayValueProp 3684 3712 +0.8% 0.99x (?)
ArrayValueProp2 15724 15724 +0.0% 1.00x
ArrayValueProp3 4180 4163 -0.4% 1.00x (?)
ArrayValueProp4 4148 4126 -0.5% 1.01x
BinaryFloatingPointConversionFromBinaryInteger 5410 5624 +4.0% 0.96x
BinaryFloatingPointPropertiesBinade 85 85 +0.0% 1.00x
BinaryFloatingPointPropertiesNextUp 131 131 +0.0% 1.00x
BinaryFloatingPointPropertiesUlp 131 131 +0.0% 1.00x
BitCount 8995 8997 +0.0% 1.00x (?)
ByteSwap 9598 9608 +0.1% 1.00x (?)
COWTree 12552 12150 -3.2% 1.03x (?)
CSVParsing 2523532 2547659 +1.0% 0.99x (?)
CSVParsingAlt 1407432 1389429 -1.3% 1.01x (?)
CSVParsingAltIndices 2456333 2439154 -0.7% 1.01x (?)
CStringLongAscii 4459 4581 +2.7% 0.97x
CStringLongNonAscii 2204 2208 +0.2% 1.00x (?)
CStringShortAscii 8375 8108 -3.2% 1.03x (?)
Calculator 1243 1240 -0.2% 1.00x
CaptureProp 257357 256425 -0.4% 1.00x
ChainedFilterMap 231754 231685 -0.0% 1.00x (?)
CharIndexing_ascii_unicodeScalars_Backwards 419467 438580 +4.6% 0.96x (?)
CharIndexing_chinese_unicodeScalars_Backwards 320688 323489 +0.9% 0.99x (?)
CharIndexing_japanese_unicodeScalars 385608 402982 +4.5% 0.96x (?)
CharIndexing_japanese_unicodeScalars_Backwards 498764 521296 +4.5% 0.96x (?)
CharIndexing_korean_unicodeScalars_Backwards 411154 419542 +2.0% 0.98x (?)
CharIndexing_punctuatedJapanese_unicodeScalars 58263 60919 +4.6% 0.96x (?)
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 72951 73337 +0.5% 0.99x
CharIndexing_punctuated_unicodeScalars 73366 77127 +5.1% 0.95x (?)
CharIndexing_punctuated_unicodeScalars_Backwards 89901 92376 +2.8% 0.97x
CharIndexing_russian_unicodeScalars 274925 287341 +4.5% 0.96x
CharIndexing_russian_unicodeScalars_Backwards 349656 355109 +1.6% 0.98x (?)
CharIndexing_tweet_unicodeScalars_Backwards 818107 856557 +4.7% 0.96x (?)
CharIndexing_utf16_unicodeScalars 277046 288868 +4.3% 0.96x
CharIndexing_utf16_unicodeScalars_Backwards 336956 349119 +3.6% 0.97x
CharIteration_ascii_unicodeScalars 148810 148738 -0.0% 1.00x (?)
CharIteration_ascii_unicodeScalars_Backwards 297345 301956 +1.6% 0.98x
CharIteration_chinese_unicodeScalars 112589 115914 +3.0% 0.97x
CharIteration_chinese_unicodeScalars_Backwards 223531 230425 +3.1% 0.97x
CharIteration_japanese_unicodeScalars 177725 177794 +0.0% 1.00x (?)
CharIteration_japanese_unicodeScalars_Backwards 360056 366415 +1.8% 0.98x (?)
CharIteration_korean_unicodeScalars 144413 144960 +0.4% 1.00x (?)
CharIteration_korean_unicodeScalars_Backwards 288464 294400 +2.1% 0.98x (?)
CharIteration_punctuatedJapanese_unicodeScalars 26703 26701 -0.0% 1.00x (?)
CharIteration_punctuatedJapanese_unicodeScalars_Backwards 53035 54287 +2.4% 0.98x
CharIteration_punctuated_unicodeScalars 33250 33568 +1.0% 0.99x (?)
CharIteration_punctuated_unicodeScalars_Backwards 65801 68969 +4.8% 0.95x
CharIteration_russian_unicodeScalars 123439 123698 +0.2% 1.00x (?)
CharIteration_russian_unicodeScalars_Backwards 246252 253151 +2.8% 0.97x
CharIteration_tweet_unicodeScalars 294641 293873 -0.3% 1.00x (?)
CharIteration_utf16_unicodeScalars 126648 127824 +0.9% 0.99x (?)
CharIteration_utf16_unicodeScalars_Backwards 244761 250719 +2.4% 0.98x (?)
CharacterLiteralsLarge 5692 5747 +1.0% 0.99x (?)
CharacterLiteralsSmall 683 659 -3.5% 1.04x
CharacterPropertiesFetch 5695 5654 -0.7% 1.01x (?)
CharacterPropertiesPrecomputed 3875 3814 -1.6% 1.02x (?)
CharacterPropertiesStashed 2312 2351 +1.7% 0.98x (?)
CharacterPropertiesStashedMemo 4797 4773 -0.5% 1.01x (?)
Chars 35542 35758 +0.6% 0.99x
ClassArrayGetter 989 984 -0.5% 1.01x
Combos 2431 2487 +2.3% 0.98x (?)
DataAccessBytes 2344 2302 -1.8% 1.02x
DataAppendArray 5866 5835 -0.5% 1.01x (?)
DataAppendBytes 5348 5398 +0.9% 0.99x (?)
DataAppendDataLargeToLarge 67075 68141 +1.6% 0.98x (?)
DataAppendDataLargeToMedium 35291 35442 +0.4% 1.00x (?)
DataAppendDataLargeToSmall 34582 34421 -0.5% 1.00x (?)
DataAppendDataMediumToLarge 37586 38005 +1.1% 0.99x (?)
DataAppendDataMediumToSmall 5937 5920 -0.3% 1.00x (?)
DataAppendDataSmallToLarge 37071 37253 +0.5% 1.00x (?)
DataAppendDataSmallToSmall 6230 5972 -4.1% 1.04x (?)
DataAppendSequence 1812295 1807463 -0.3% 1.00x (?)
DataCopyBytes 2477 2515 +1.5% 0.98x (?)
DataCount 223 223 +0.0% 1.00x
DataMutateBytes 5259 5164 -1.8% 1.02x (?)
DataReplaceLarge 40573 40234 -0.8% 1.01x (?)
DataReplaceLargeBuffer 57384 57836 +0.8% 0.99x (?)
DataReplaceMedium 9375 9517 +1.5% 0.99x (?)
DataReplaceSmall 6837 7029 +2.8% 0.97x (?)
DataReplaceSmallBuffer 8967 9250 +3.2% 0.97x (?)
DataReset 2886 2856 -1.0% 1.01x (?)
DataSetCount 639 639 +0.0% 1.00x
DataSubscript 443 443 +0.0% 1.00x
DictOfArraysToArrayOfDicts 3461 3492 +0.9% 0.99x (?)
Dictionary 2331 2344 +0.6% 0.99x
Dictionary2 2594 2564 -1.2% 1.01x (?)
Dictionary2OfObjects 5657 5750 +1.6% 0.98x (?)
Dictionary3 1188 1184 -0.3% 1.00x (?)
Dictionary3OfObjects 2396 2433 +1.5% 0.98x (?)
Dictionary4 1573 1566 -0.4% 1.00x
Dictionary4OfObjects 2256 2252 -0.2% 1.00x (?)
DictionaryBridge 2083 2128 +2.2% 0.98x (?)
DictionaryCopy 312419 310386 -0.7% 1.01x
DictionaryFilter 323938 324153 +0.1% 1.00x (?)
DictionaryGroup 4404 4403 -0.0% 1.00x (?)
DictionaryGroupOfObjects 7447 7550 +1.4% 0.99x (?)
DictionaryLiteral 9075 8859 -2.4% 1.02x (?)
DictionaryOfObjects 6154 6119 -0.6% 1.01x (?)
DictionaryRemove 17717 17905 +1.1% 0.99x
DictionaryRemoveOfObjects 55508 54441 -1.9% 1.02x
DictionarySubscriptDefaultMutation 2020 2050 +1.5% 0.99x
DictionarySubscriptDefaultMutationArray 2276 2295 +0.8% 0.99x (?)
DictionarySubscriptDefaultMutationArrayOfObjects 9991 9714 -2.8% 1.03x (?)
DictionarySubscriptDefaultMutationOfObjects 5539 5461 -1.4% 1.01x
DictionarySwap 5187 5205 +0.3% 1.00x (?)
DictionarySwapAt 35244 35509 +0.8% 0.99x
DictionarySwapAtOfObjects 115305 117001 +1.5% 0.99x (?)
DictionarySwapOfObjects 19761 19814 +0.3% 1.00x (?)
DoubleWidthDivision 0 0 +0.0% 1.00x
DropFirstAnyCollection 14580 14560 -0.1% 1.00x
DropFirstAnyCollectionLazy 111248 112621 +1.2% 0.99x (?)
DropFirstAnySeqCRangeIter 22779 22845 +0.3% 1.00x
DropFirstAnySeqCRangeIterLazy 22600 22775 +0.8% 0.99x (?)
DropFirstAnySeqCntRange 14420 14447 +0.2% 1.00x (?)
DropFirstAnySeqCntRangeLazy 14593 14690 +0.7% 0.99x (?)
DropFirstAnySequence 11815 11884 +0.6% 0.99x
DropFirstAnySequenceLazy 11936 11812 -1.0% 1.01x (?)
DropFirstArray 3596 3598 +0.1% 1.00x (?)
DropFirstCountableRange 309 308 -0.3% 1.00x
DropFirstCountableRangeLazy 43369 43744 +0.9% 0.99x (?)
DropFirstSequence 11528 11440 -0.8% 1.01x
DropFirstSequenceLazy 11501 11523 +0.2% 1.00x
DropLastAnyCollection 4844 4876 +0.7% 0.99x
DropLastAnyCollectionLazy 37877 37128 -2.0% 1.02x
DropLastAnySeqCRangeIter 39882 39786 -0.2% 1.00x (?)
DropLastAnySeqCRangeIterLazy 39960 39692 -0.7% 1.01x
DropLastAnySeqCntRange 4845 4815 -0.6% 1.01x (?)
DropLastAnySeqCntRangeLazy 4929 4915 -0.3% 1.00x (?)
DropLastAnySequence 29974 29667 -1.0% 1.01x
DropLastAnySequenceLazy 30130 29603 -1.7% 1.02x
DropLastCountableRange 109 109 +0.0% 1.00x
DropLastSequence 29843 29503 -1.1% 1.01x
DropLastSequenceLazy 29813 29588 -0.8% 1.01x
DropWhileAnyCollection 19055 19027 -0.1% 1.00x (?)
DropWhileAnyCollectionLazy 21289 21269 -0.1% 1.00x (?)
DropWhileAnySeqCRangeIter 23600 23630 +0.1% 1.00x (?)
DropWhileAnySeqCRangeIterLazy 21215 21256 +0.2% 1.00x (?)
DropWhileAnySeqCntRange 19053 18922 -0.7% 1.01x
DropWhileAnySeqCntRangeLazy 21275 21267 -0.0% 1.00x (?)
DropWhileAnySequence 12711 12761 +0.4% 1.00x
DropWhileAnySequenceLazy 11348 11314 -0.3% 1.00x (?)
DropWhileArrayLazy 13935 14018 +0.6% 0.99x
DropWhileCountableRange 4659 4644 -0.3% 1.00x (?)
DropWhileCountableRangeLazy 20860 20831 -0.1% 1.00x (?)
DropWhileSequence 12311 12371 +0.5% 1.00x
DropWhileSequenceLazy 11147 11093 -0.5% 1.00x (?)
EqualStringSubstring 70 71 +1.4% 0.99x
EqualSubstringString 70 70 +0.0% 1.00x
EqualSubstringSubstring 71 71 +0.0% 1.00x
EqualSubstringSubstringGenericEquatable 54 54 +0.0% 1.00x
ErrorHandling 6866 6652 -3.1% 1.03x (?)
ExclusivityGlobal 186 186 +0.0% 1.00x
ExclusivityIndependent 76 76 +0.0% 1.00x
FatCompactMap 295957 297530 +0.5% 0.99x
FilterEvenUsingReduce 3590 3571 -0.5% 1.01x (?)
FilterEvenUsingReduceInto 1865 1864 -0.1% 1.00x (?)
FloatingPointPrinting_Double_description_small 80842 80801 -0.1% 1.00x (?)
FloatingPointPrinting_Double_description_uniform 155609 156522 +0.6% 0.99x (?)
FloatingPointPrinting_Double_interpolated 254765 246921 -3.1% 1.03x (?)
FloatingPointPrinting_Float80_description_small 94631 95962 +1.4% 0.99x
FloatingPointPrinting_Float80_description_uniform 1746870 1745654 -0.1% 1.00x (?)
FloatingPointPrinting_Float80_interpolated 1837844 1846599 +0.5% 1.00x (?)
FloatingPointPrinting_Float_description_small 43223 42792 -1.0% 1.01x
FrequenciesUsingReduce 14585 14810 +1.5% 0.98x (?)
Hanoi 20215 20144 -0.4% 1.00x
HashTest 22360 22359 -0.0% 1.00x (?)
Histogram 6425 6445 +0.3% 1.00x (?)
Integrate 458 459 +0.2% 1.00x
IterateData 5437 5475 +0.7% 0.99x
Join 1079 1084 +0.5% 1.00x
LazilyFilteredArrayContains 751141 750453 -0.1% 1.00x (?)
LazilyFilteredArrays 1415542 1423588 +0.6% 0.99x
LazilyFilteredRange 506792 506291 -0.1% 1.00x (?)
LessSubstringSubstring 71 71 +0.0% 1.00x
LessSubstringSubstringGenericComparable 54 55 +1.9% 0.98x
LinkedList 32157 32099 -0.2% 1.00x (?)
LuhnAlgoEager 6295 6028 -4.2% 1.04x
LuhnAlgoLazy 6157 6021 -2.2% 1.02x (?)
MapReduce 25616 25477 -0.5% 1.01x
MapReduceAnyCollection 25418 25482 +0.3% 1.00x
MapReduceAnyCollectionShort 36137 37323 +3.3% 0.97x (?)
MapReduceClass 29443 29563 +0.4% 1.00x
MapReduceClassShort 40248 40450 +0.5% 1.00x (?)
MapReduceLazyCollection 23175 22730 -1.9% 1.02x
MapReduceLazyCollectionShort 33413 32865 -1.6% 1.02x (?)
MapReduceLazySequence 19253 19503 +1.3% 0.99x
MapReduceSequence 29304 29355 +0.2% 1.00x (?)
MapReduceShort 37385 37351 -0.1% 1.00x (?)
MapReduceShortString 240 240 +0.0% 1.00x
MapReduceString 1867 1830 -2.0% 1.02x (?)
Memset 44407 44417 +0.0% 1.00x (?)
MonteCarloE 1130262 1149485 +1.7% 0.98x
MonteCarloPi 5131796 5210247 +1.5% 0.98x (?)
NSDictionaryCastToSwift 6633 6711 +1.2% 0.99x (?)
NSStringConversion 438 438 +0.0% 1.00x
NibbleSort 482193 483859 +0.3% 1.00x (?)
NopDeinit 193655 193597 -0.0% 1.00x
ObjectAllocation 1268 1273 +0.4% 1.00x (?)
ObjectiveCBridgeFromNSArrayAnyObject 26962 27566 +2.2% 0.98x
ObjectiveCBridgeFromNSArrayAnyObjectForced 9006 9259 +2.8% 0.97x (?)
ObjectiveCBridgeFromNSDictionaryAnyObject 108701 104974 -3.4% 1.04x
ObjectiveCBridgeFromNSSetAnyObject 50588 51115 +1.0% 0.99x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 5351 5626 +5.1% 0.95x (?)
ObjectiveCBridgeFromNSSetAnyObjectToString 88580 90027 +1.6% 0.98x (?)
ObjectiveCBridgeFromNSString 2691 2790 +3.7% 0.96x (?)
ObjectiveCBridgeFromNSStringForced 2605 2576 -1.1% 1.01x (?)
ObjectiveCBridgeStubDataAppend 5838 5784 -0.9% 1.01x (?)
ObjectiveCBridgeStubDateMutation 746 745 -0.1% 1.00x (?)
ObjectiveCBridgeStubFromNSDate 8079 8129 +0.6% 0.99x (?)
ObjectiveCBridgeStubFromNSString 974 985 +1.1% 0.99x (?)
ObjectiveCBridgeStubFromNSStringRef 194 193 -0.5% 1.01x (?)
ObjectiveCBridgeStubNSDataAppend 3055 2962 -3.0% 1.03x (?)
ObjectiveCBridgeStubNSDateMutationRef 16232 15929 -1.9% 1.02x (?)
ObjectiveCBridgeStubToArrayOfNSString 27762 28003 +0.9% 0.99x (?)
ObjectiveCBridgeStubToNSDateRef 3472 3467 -0.1% 1.00x (?)
ObjectiveCBridgeStubToNSString 1597 1602 +0.3% 1.00x (?)
ObjectiveCBridgeStubToNSStringRef 150 150 +0.0% 1.00x
ObjectiveCBridgeStubURLAppendPath 371977 363846 -2.2% 1.02x (?)
ObjectiveCBridgeStubURLAppendPathRef 378561 374368 -1.1% 1.01x (?)
ObjectiveCBridgeToNSArray 28514 28572 +0.2% 1.00x (?)
ObjectiveCBridgeToNSDictionary 44794 44440 -0.8% 1.01x (?)
ObjectiveCBridgeToNSSet 34025 34282 +0.8% 0.99x (?)
ObjectiveCBridgeToNSString 1344 1342 -0.1% 1.00x (?)
ObserverClosure 6471 6478 +0.1% 1.00x (?)
ObserverForwarderStruct 4449 4441 -0.2% 1.00x (?)
ObserverPartiallyAppliedMethod 8032 8079 +0.6% 0.99x (?)
ObserverUnappliedMethod 8102 8106 +0.0% 1.00x (?)
OpenClose 498 504 +1.2% 0.99x
PartialApplyDynamicType 39968 39988 +0.1% 1.00x (?)
Phonebook 17528 17428 -0.6% 1.01x (?)
PointerArithmetics 117383 117397 +0.0% 1.00x (?)
PolymorphicCalls 2458 2467 +0.4% 1.00x (?)
PopFrontArray 4593 4671 +1.7% 0.98x (?)
PopFrontArrayGeneric 5459 5495 +0.7% 0.99x
PopFrontUnsafePointer 10425 10375 -0.5% 1.00x (?)
PrefixAnyCollection 14483 14526 +0.3% 1.00x (?)
PrefixAnySeqCRangeIter 18304 18389 +0.5% 1.00x (?)
PrefixAnySeqCRangeIterLazy 18165 18236 +0.4% 1.00x (?)
PrefixAnySeqCntRange 14499 14480 -0.1% 1.00x (?)
PrefixAnySeqCntRangeLazy 14719 14704 -0.1% 1.00x (?)
PrefixAnySequence 9655 9730 +0.8% 0.99x (?)
PrefixAnySequenceLazy 9806 9751 -0.6% 1.01x (?)
PrefixArray 3579 3587 +0.2% 1.00x (?)
PrefixCountableRange 310 309 -0.3% 1.00x (?)
PrefixSequence 9390 9310 -0.9% 1.01x
PrefixSequenceLazy 9420 9352 -0.7% 1.01x (?)
PrefixWhileAnyCollection 27310 27398 +0.3% 1.00x (?)
PrefixWhileAnyCollectionLazy 17658 17535 -0.7% 1.01x (?)
PrefixWhileAnySeqCRangeIter 33551 33514 -0.1% 1.00x (?)
PrefixWhileAnySeqCRangeIterLazy 17887 17676 -1.2% 1.01x (?)
PrefixWhileAnySeqCntRange 27264 27220 -0.2% 1.00x (?)
PrefixWhileAnySequence 26047 25902 -0.6% 1.01x (?)
PrefixWhileAnySequenceLazy 10209 10143 -0.6% 1.01x (?)
PrefixWhileArray 10536 10602 +0.6% 0.99x (?)
PrefixWhileArrayLazy 12167 12240 +0.6% 0.99x
PrefixWhileCountableRange 13096 13200 +0.8% 0.99x (?)
PrefixWhileCountableRangeLazy 17575 17434 -0.8% 1.01x (?)
PrefixWhileSequence 25681 25580 -0.4% 1.00x (?)
PrefixWhileSequenceLazy 9935 9946 +0.1% 1.00x (?)
Prims 9809 9742 -0.7% 1.01x (?)
PrimsSplit 9741 9759 +0.2% 1.00x (?)
QueueConcrete 14310 14255 -0.4% 1.00x (?)
QueueGeneric 18881 18821 -0.3% 1.00x (?)
RC4 16241 16231 -0.1% 1.00x (?)
RGBHistogram 24657 24775 +0.5% 1.00x (?)
RGBHistogramOfObjects 79488 76660 -3.6% 1.04x (?)
RangeAssignment 2683 2668 -0.6% 1.01x
RangeIterationSigned 14764 14943 +1.2% 0.99x
RangeReplaceableCollectionPlusDefault 11024 10928 -0.9% 1.01x (?)
RecursiveOwnedParameter 5786 5763 -0.4% 1.00x (?)
RemoveWhereFilterInts 1936 1963 +1.4% 0.99x
RemoveWhereFilterString 1301 1306 +0.4% 1.00x (?)
RemoveWhereFilterStrings 2448 2458 +0.4% 1.00x
RemoveWhereMoveInts 3375 3361 -0.4% 1.00x (?)
RemoveWhereMoveStrings 3883 3881 -0.1% 1.00x
RemoveWhereQuadraticInts 7972 7965 -0.1% 1.00x (?)
RemoveWhereQuadraticStrings 9616 9651 +0.4% 1.00x
RemoveWhereSwapInts 6090 6075 -0.2% 1.00x (?)
RemoveWhereSwapStrings 6790 6795 +0.1% 1.00x (?)
ReversedArray 13912 13466 -3.2% 1.03x (?)
ReversedBidirectional 46219 44403 -3.9% 1.04x
ReversedDictionary 22672 22767 +0.4% 1.00x (?)
RomanNumbers 1238330 1240278 +0.2% 1.00x (?)
SequenceAlgosAnySequence 12318 12357 +0.3% 1.00x
SequenceAlgosArray 748828 752334 +0.5% 1.00x
SequenceAlgosContiguousArray 286589 287309 +0.3% 1.00x (?)
SequenceAlgosList 8216 8311 +1.2% 0.99x
SequenceAlgosRange 1203634 1206562 +0.2% 1.00x (?)
SequenceAlgosUnfoldSequence 5862 5880 +0.3% 1.00x (?)
SetExclusiveOr 16993 17510 +3.0% 0.97x
SetExclusiveOr_OfObjects 45388 45430 +0.1% 1.00x (?)
SetIntersect 6903 6884 -0.3% 1.00x (?)
SetIntersect_OfObjects 11236 11020 -1.9% 1.02x (?)
SetIsSubsetOf 1223 1216 -0.6% 1.01x (?)
SetIsSubsetOf_OfObjects 1764 1760 -0.2% 1.00x (?)
SetUnion 12234 12399 +1.3% 0.99x
SetUnion_OfObjects 32096 32378 +0.9% 0.99x (?)
SevenBoom 1675 1676 +0.1% 1.00x (?)
Sim2DArray 44696 44688 -0.0% 1.00x (?)
SortLargeExistentials 11090 11134 +0.4% 1.00x
SortLettersInPlace 1835 1844 +0.5% 1.00x (?)
SortSortedStrings 901 912 +1.2% 0.99x
SortStrings 1814 1793 -1.2% 1.01x
SortStringsUnicode 2550 2570 +0.8% 0.99x
StackPromo 98922 97339 -1.6% 1.02x (?)
StaticArray 2636 2658 +0.8% 0.99x
StrComplexWalk 6417 6413 -0.1% 1.00x (?)
StrToInt 77192 75646 -2.0% 1.02x (?)
StringAdder 4736 4714 -0.5% 1.00x
StringBuilder 6510 6670 +2.5% 0.98x
StringBuilderLong 2773 2781 +0.3% 1.00x
StringBuilderWithLongSubstring 5052 4975 -1.5% 1.02x (?)
StringComparison_abnormal 1402 1383 -1.4% 1.01x (?)
StringComparison_emoji 1947 2008 +3.1% 0.97x (?)
StringComparison_fastPrenormal 4816 4851 +0.7% 0.99x (?)
StringComparison_latin1 3747 3773 +0.7% 0.99x
StringComparison_longSharedPrefix 2307 2305 -0.1% 1.00x (?)
StringComparison_nonBMPSlowestPrenormal 3804 3831 +0.7% 0.99x (?)
StringComparison_slowerPrenormal 4038 4055 +0.4% 1.00x (?)
StringComparison_zalgo 126568 127540 +0.8% 0.99x
StringEdits 347926 361776 +4.0% 0.96x (?)
StringEnumRawValueInitialization 16690 16792 +0.6% 0.99x (?)
StringEqualPointerComparison 1620 1571 -3.0% 1.03x
StringFromLongWholeSubstring 22 22 +0.0% 1.00x
StringFromLongWholeSubstringGeneric 338 336 -0.6% 1.01x (?)
StringHasPrefixAscii 3064 3017 -1.5% 1.02x
StringHasPrefixUnicode 113058 113227 +0.1% 1.00x (?)
StringHasSuffixAscii 3294 3273 -0.6% 1.01x
StringHasSuffixUnicode 104981 105688 +0.7% 0.99x (?)
StringInterpolation 14487 14754 +1.8% 0.98x (?)
StringInterpolationManySmallSegments 22422 22485 +0.3% 1.00x (?)
StringInterpolationSmall 12836 12944 +0.8% 0.99x (?)
StringMatch 33502 34060 +1.7% 0.98x (?)
StringRemoveDupes 1391 1397 +0.4% 1.00x (?)
StringUTF16Builder 7212 7263 +0.7% 0.99x (?)
StringWalk 13010 13024 +0.1% 1.00x (?)
StringWithCString 37583 37577 -0.0% 1.00x (?)
SubstringComparable 1577 1588 +0.7% 0.99x
SubstringEquatable 5321 5260 -1.1% 1.01x (?)
SubstringFromLongString 24 24 +0.0% 1.00x
SubstringFromLongStringGeneric 100 100 +0.0% 1.00x
SuffixAnyCollection 4880 4860 -0.4% 1.00x (?)
SuffixAnyCollectionLazy 38077 36828 -3.3% 1.03x
SuffixAnySeqCRangeIter 35434 35626 +0.5% 0.99x
SuffixAnySeqCRangeIterLazy 35317 37071 +5.0% 0.95x (?)
SuffixAnySeqCntRange 4863 4823 -0.8% 1.01x
SuffixAnySeqCntRangeLazy 4920 4917 -0.1% 1.00x (?)
SuffixAnySequence 25299 25370 +0.3% 1.00x
SuffixAnySequenceLazy 25411 25278 -0.5% 1.01x
SuffixCountableRange 109 109 +0.0% 1.00x
SuffixSequence 25144 25076 -0.3% 1.00x (?)
SuffixSequenceLazy 25357 25258 -0.4% 1.00x (?)
SumUsingReduce 158612 160072 +0.9% 0.99x (?)
SumUsingReduceInto 152716 152741 +0.0% 1.00x (?)
SuperChars 113376 112884 -0.4% 1.00x (?)
TwoSum 3665 3737 +2.0% 0.98x
TypeFlood 196 198 +1.0% 0.99x (?)
UTF8Decode 29396 29595 +0.7% 0.99x
Walsh 12004 12017 +0.1% 1.00x (?)
WordCountHistogramASCII 37586 36918 -1.8% 1.02x (?)
WordCountHistogramUTF16 44444 44516 +0.2% 1.00x (?)
WordCountUniqueASCII 7399 7444 +0.6% 0.99x
WordCountUniqueUTF16 12408 12378 -0.2% 1.00x
WordSplitUTF16 26895 26287 -2.3% 1.02x (?)
XorLoop 23255 23236 -0.1% 1.00x
Hardware Overview
  Model Name: Mac Pro
  Model Identifier: MacPro6,1
  Processor Name: 12-Core Intel Xeon E5
  Processor Speed: 2.7 GHz
  Number of Processors: 1
  Total Number of Cores: 12
  L2 Cache (per Core): 256 KB
  L3 Cache: 30 MB
  Memory: 64 GB

Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

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

I don't know the surrounding code. If this is to be a precondition, should it be checked prior to calling unsafeAddNew ?

@lorentey
Copy link
Member Author

lorentey commented Mar 28, 2018

Precondition checks can be done at any time; there is no requirement to do them in any particular order wrt other operations. (precondition is simply a sanityCheck that we also perform in release builds, typically to check for programmer mistakes like out of bounds indices.) In this case, the cheapest way to verify that the key to be inserted is not already in the table is to try looking up its insertion bucket and to see if there was already a matching member -- doing a standalone check would require a second lookup.

(The unsafe prefix in unsafeAddNew is there because performing the insertion over an existing element may leak memory. However, the precondition check will now trigger before that happens.)

Set and Dictionary call unsafeAddNew while rehashing, to copy elements between the old and new storage. (And also during certain bridging operations that do similar en bloc transformations.)

@lorentey
Copy link
Member Author

Blërg, smoke benchmarks are noisy. I don't see an obviously relevant regression.

@milseman
Copy link
Member

So, it's no longer "unsafe"? Preconditions and debug preconditions are part of the standard library's interface. Sanity checks are for internal assertions. We need some kind of delineation between checks as part of the interface and internal invariant checks. Lacking features, my understanding is that we've done so through names such as "unsafe" or "unchecked", which we call after performing interface checks.

@lorentey
Copy link
Member Author

unsafeAddNew was never a particularly good name for this function; it will probably get a better name in the upcoming reorganization. But arguably, it is still unsafe after this change, because it doesn't perform a uniqueness check before updating the buffer.

My changing of sanityCheck to precondition was due to the realization that the check may fail because the program (not the stdlib) did something bad. The check is most definitely an interface check, but the problem it checks for is complicated, and not necessarily related to the operation that actually triggered the unsafeAddNew call.

Mutating a hash key is a subtle but serious programming error. It is special in that

  1. it happens outside of any Set/Dictionary operation, so we can't pinpoint the exact line of code that breaks the hash table
  2. it is extremely hard to catch during regular Set/Dictionary operations (simple lookups, non-reallocating insertions/removals). Mutated entries often behave as if they disappeared from the table, but they may randomly reappear at any point to wreak havoc.

This particular function, deep inside the guts of our hash tables, is one of the few places where hashed collections are sometimes able to detect mutated keys. Leaving the check as a _sanityCheck would be a disservice to our users, as it would only serve to hide a serious problem in their code.

@lorentey
Copy link
Member Author

LGTM!

@lorentey lorentey merged commit 5f32944 into swiftlang:master Mar 28, 2018
@lorentey lorentey deleted the detect-mutations branch March 28, 2018 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants