Skip to content

Fix benchmark suite on 32-bit platforms #17268

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 2 commits into from
Jun 18, 2018
Merged

Conversation

lorentey
Copy link
Member

  • Fix integer overflow issues with iteration count
  • Fix RandomIntegersLCG to use an integer type with a non-varying width

rdar://problem/41177686

lorentey added 2 commits June 15, 2018 16:56
The automatic scaling mechanism may end up with iteration counts greater than 2^31, leading to integer overflow.
Values returned by random APIs depend on the bitWidth of the underlying integer type; make sure we use a consistent integer width when expecting particular results.
@lorentey
Copy link
Member Author

@swift-ci please smoke test

@lorentey
Copy link
Member Author

@swift-ci please smoke benchmark

Copy link
Member

@natecook1000 natecook1000 left a comment

Choose a reason for hiding this comment

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

LGTM!

@swift-ci
Copy link
Contributor

Build comment file:

Optimized (O)

Regression (3)
TEST OLD NEW DELTA SPEEDUP
DropLastAnySeqCntRange 12 13 +8.3% 0.92x
DropLastAnySeqCntRangeLazy 12 13 +8.3% 0.92x
MapReduceString 44 47 +6.8% 0.94x
Improvement (59)
TEST OLD NEW DELTA SPEEDUP
Calculator 225 178 -20.9% 1.26x
DataAppendDataSmallToSmall 6930 5776 -16.7% 1.20x
CStringShortAscii 3990 3349 -16.1% 1.19x
CharIteration_korean_unicodeScalars 22541 18925 -16.0% 1.19x
ChainedFilterMap 1440 1214 -15.7% 1.19x
CharIteration_punctuated_unicodeScalars 5230 4417 -15.5% 1.18x
CharacterPropertiesStashed 1738 1469 -15.5% 1.18x
CStringLongAscii 4513 3817 -15.4% 1.18x
CharacterPropertiesStashedMemo 1807 1531 -15.3% 1.18x
CharIndexing_korean_unicodeScalars 18262 15505 -15.1% 1.18x
CharIndexing_japanese_unicodeScalars 22587 19186 -15.1% 1.18x
CharIndexing_ascii_unicodeScalars 18801 15991 -14.9% 1.18x
Combos 589 501 -14.9% 1.18x
CharIndexing_russian_unicodeScalars 15659 13324 -14.9% 1.18x
CStringLongNonAscii 2540 2163 -14.8% 1.17x
CharIndexing_punctuatedJapanese_unicodeScalars 3389 2890 -14.7% 1.17x
CharIndexing_chinese_unicodeScalars 14197 12107 -14.7% 1.17x
DataReplaceMediumBuffer 12379 10558 -14.7% 1.17x
CSVParsingAlt 957603 816936 -14.7% 1.17x
CharIndexing_punctuated_unicodeScalars 4239 3618 -14.6% 1.17x
DataMutateBytes 4583 3913 -14.6% 1.17x
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 3243 2771 -14.6% 1.17x
CharIndexing_tweet_unicodeScalars 36896 31559 -14.5% 1.17x
CharacterPropertiesFetch 5521 4727 -14.4% 1.17x
CSVParsingAltIndices 405120 347027 -14.3% 1.17x
CharIteration_korean_unicodeScalars_Backwards 15220 13039 -14.3% 1.17x
CharIteration_tweet_unicodeScalars 44725 38392 -14.2% 1.16x
CharIndexing_chinese_unicodeScalars_Backwards 13726 11783 -14.2% 1.16x
CharIteration_punctuatedJapanese_unicodeScalars_Backwards 2881 2474 -14.1% 1.16x
DataReplaceSmall 6373 5476 -14.1% 1.16x
CharIndexing_ascii_unicodeScalars_Backwards 18105 15568 -14.0% 1.16x
CharIteration_punctuatedJapanese_unicodeScalars 4088 3516 -14.0% 1.16x
CharIndexing_japanese_unicodeScalars_Backwards 21666 18643 -14.0% 1.16x
CharIteration_utf16_unicodeScalars_Backwards 20193 17394 -13.9% 1.16x
CharIndexing_korean_unicodeScalars_Backwards 17522 15095 -13.9% 1.16x
CharIndexing_tweet_unicodeScalars_Backwards 35552 30737 -13.5% 1.16x
CharIteration_chinese_unicodeScalars_Backwards 11794 10197 -13.5% 1.16x
CharIndexing_punctuated_unicodeScalars_Backwards 4060 3511 -13.5% 1.16x
CharIteration_punctuated_unicodeScalars_Backwards 3565 3083 -13.5% 1.16x
CharIndexing_russian_unicodeScalars_Backwards 14914 12964 -13.1% 1.15x
CharIteration_chinese_unicodeScalars 16979 14785 -12.9% 1.15x
DataAccessBytes 1382 1204 -12.9% 1.15x
CharacterPropertiesPrecomputed 1224 1067 -12.8% 1.15x
BitCount 165 144 -12.7% 1.15x
StaticArray 8 7 -12.5% 1.14x
Chars 965 846 -12.3% 1.14x
DataAppendArray 5883 5158 -12.3% 1.14x
CharIteration_utf16_unicodeScalars 31570 28020 -11.2% 1.13x
CharIteration_russian_unicodeScalars_Backwards 12304 11209 -8.9% 1.10x
DataCount 36 33 -8.3% 1.09x
DataAppendSequence 17521 16103 -8.1% 1.09x
EqualSubstringSubstring 43 40 -7.0% 1.07x
DataReplaceLarge 40075 37350 -6.8% 1.07x
DataAppendDataLargeToSmall 38055 35757 -6.0% 1.06x (?)
ArrayAppendGenericStructs 1375 1292 -6.0% 1.06x
DataAppendDataSmallToMedium 6336 5958 -6.0% 1.06x
ArrayOfGenericPOD2 155 146 -5.8% 1.06x
CharIteration_tweet_unicodeScalars_Backwards 28164 26552 -5.7% 1.06x
ArrayAppendLatin1Substring 138671 131958 -4.8% 1.05x
No Changes (384)
TEST OLD NEW DELTA SPEEDUP
AngryPhonebook 3120 3067 -1.7% 1.02x (?)
AnyHashableWithAClass 90349 90052 -0.3% 1.00x
Array2D 2255 2218 -1.6% 1.02x (?)
ArrayAppend 1077 1070 -0.6% 1.01x
ArrayAppendArrayOfInt 642 629 -2.0% 1.02x
ArrayAppendAscii 3816 3726 -2.4% 1.02x
ArrayAppendAsciiSubstring 21994 21081 -4.2% 1.04x
ArrayAppendFromGeneric 647 633 -2.2% 1.02x
ArrayAppendLatin1 41271 39560 -4.1% 1.04x
ArrayAppendLazyMap 1004 977 -2.7% 1.03x
ArrayAppendOptionals 1340 1285 -4.1% 1.04x
ArrayAppendRepeatCol 1137 1117 -1.8% 1.02x
ArrayAppendReserved 821 817 -0.5% 1.00x
ArrayAppendSequence 982 968 -1.4% 1.01x
ArrayAppendStrings 6639 6436 -3.1% 1.03x
ArrayAppendToFromGeneric 640 627 -2.0% 1.02x
ArrayAppendToGeneric 628 628 +0.0% 1.00x
ArrayAppendUTF16 38991 38859 -0.3% 1.00x (?)
ArrayAppendUTF16Substring 131695 132112 +0.3% 1.00x (?)
ArrayInClass 67 67 +0.0% 1.00x
ArrayLiteral 0 0 +0.0% 1.00x
ArrayOfGenericRef 4636 4492 -3.1% 1.03x
ArrayOfPOD 171 170 -0.6% 1.01x
ArrayOfRef 4634 4460 -3.8% 1.04x
ArrayPlusEqualArrayOfInt 640 627 -2.0% 1.02x
ArrayPlusEqualFiveElementCollection 5777 5652 -2.2% 1.02x
ArrayPlusEqualSingleElementCollection 1083 1065 -1.7% 1.02x
ArrayPlusEqualThreeElements 1757 1711 -2.6% 1.03x
ArraySubscript 1572 1501 -4.5% 1.05x
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
BinaryFloatingPointPropertiesBinade 27 27 +0.0% 1.00x
BinaryFloatingPointPropertiesNextUp 27 27 +0.0% 1.00x
BinaryFloatingPointPropertiesUlp 30 30 +0.0% 1.00x
ByteSwap 123 118 -4.1% 1.04x
COWArrayGuaranteedParameterOverhead 8837 8807 -0.3% 1.00x (?)
COWTree 5386 5439 +1.0% 0.99x (?)
CSVParsing 674345 669262 -0.8% 1.01x
CaptureProp 4524 4425 -2.2% 1.02x
CharIndexing_utf16_unicodeScalars 22927 22939 +0.1% 1.00x (?)
CharIndexing_utf16_unicodeScalars_Backwards 23207 23218 +0.0% 1.00x (?)
CharIteration_ascii_unicodeScalars 19618 19487 -0.7% 1.01x
CharIteration_ascii_unicodeScalars_Backwards 13530 13447 -0.6% 1.01x
CharIteration_japanese_unicodeScalars 23487 23324 -0.7% 1.01x
CharIteration_japanese_unicodeScalars_Backwards 16480 16085 -2.4% 1.02x
CharIteration_russian_unicodeScalars 16372 16236 -0.8% 1.01x
CharacterLiteralsLarge 6251 6060 -3.1% 1.03x
CharacterLiteralsSmall 235 232 -1.3% 1.01x
ClassArrayGetter 13 13 +0.0% 1.00x
DataAppendBytes 4842 4790 -1.1% 1.01x (?)
DataAppendDataLargeToLarge 71155 67977 -4.5% 1.05x (?)
DataAppendDataLargeToMedium 36072 36268 +0.5% 0.99x (?)
DataAppendDataMediumToLarge 38429 38524 +0.2% 1.00x (?)
DataAppendDataMediumToMedium 6373 6345 -0.4% 1.00x (?)
DataAppendDataMediumToSmall 5802 5750 -0.9% 1.01x (?)
DataAppendDataSmallToLarge 38750 39781 +2.7% 0.97x (?)
DataCopyBytes 369 366 -0.8% 1.01x
DataReplaceLargeBuffer 57921 57770 -0.3% 1.00x (?)
DataReplaceMedium 7640 7638 -0.0% 1.00x (?)
DataReplaceSmallBuffer 8319 8375 +0.7% 0.99x (?)
DataReset 2728 2727 -0.0% 1.00x (?)
DataSetCount 540 540 +0.0% 1.00x
DataSubscript 218 218 +0.0% 1.00x
DictOfArraysToArrayOfDicts 796 794 -0.3% 1.00x (?)
Dictionary 493 494 +0.2% 1.00x (?)
Dictionary2 626 625 -0.2% 1.00x (?)
Dictionary2OfObjects 2084 2086 +0.1% 1.00x (?)
Dictionary3 215 215 +0.0% 1.00x
Dictionary3OfObjects 752 750 -0.3% 1.00x
Dictionary4 324 328 +1.2% 0.99x
Dictionary4Legacy 718 714 -0.6% 1.01x
Dictionary4OfObjects 439 447 +1.8% 0.98x
Dictionary4OfObjectsLegacy 949 952 +0.3% 1.00x
DictionaryBridge 893 890 -0.3% 1.00x (?)
DictionaryCopy 106894 107943 +1.0% 0.99x (?)
DictionaryFilter 104442 107668 +3.1% 0.97x (?)
DictionaryGroup 212 222 +4.7% 0.95x
DictionaryGroupOfObjects 2173 2162 -0.5% 1.01x
DictionaryKeysContainsCocoa 36 36 +0.0% 1.00x
DictionaryKeysContainsNative 29 29 +0.0% 1.00x
DictionaryLiteral 1923 1923 +0.0% 1.00x
DictionaryOfObjects 2387 2397 +0.4% 1.00x (?)
DictionaryRemove 4136 4123 -0.3% 1.00x
DictionaryRemoveOfObjects 26526 26452 -0.3% 1.00x (?)
DictionarySubscriptDefaultMutation 252 252 +0.0% 1.00x
DictionarySubscriptDefaultMutationArray 605 605 +0.0% 1.00x
DictionarySubscriptDefaultMutationArrayOfObjects 4098 4101 +0.1% 1.00x (?)
DictionarySubscriptDefaultMutationOfObjects 1748 1750 +0.1% 1.00x (?)
DictionarySwap 1059 1057 -0.2% 1.00x
DictionarySwapAt 6889 6892 +0.0% 1.00x (?)
DictionarySwapAtOfObjects 54142 54481 +0.6% 0.99x (?)
DictionarySwapOfObjects 9063 9164 +1.1% 0.99x
DoubleWidthDivision 0 0 +0.0% 1.00x
DropFirstAnyCollection 51 51 +0.0% 1.00x
DropFirstAnyCollectionLazy 66140 66382 +0.4% 1.00x
DropFirstAnySeqCRangeIter 21961 21982 +0.1% 1.00x (?)
DropFirstAnySeqCRangeIterLazy 21960 21985 +0.1% 1.00x
DropFirstAnySeqCntRange 34 34 +0.0% 1.00x
DropFirstAnySeqCntRangeLazy 34 34 +0.0% 1.00x
DropFirstAnySequence 5103 5171 +1.3% 0.99x
DropFirstAnySequenceLazy 5109 5178 +1.4% 0.99x
DropFirstArray 30 30 +0.0% 1.00x
DropFirstArrayLazy 30 30 +0.0% 1.00x
DropFirstCountableRange 19 19 +0.0% 1.00x
DropFirstCountableRangeLazy 19 19 +0.0% 1.00x
DropFirstSequence 2666 2666 +0.0% 1.00x
DropFirstSequenceLazy 2865 2865 +0.0% 1.00x
DropLastAnyCollection 26 26 +0.0% 1.00x
DropLastAnyCollectionLazy 22070 22063 -0.0% 1.00x (?)
DropLastAnySeqCRangeIter 3488 3496 +0.2% 1.00x (?)
DropLastAnySeqCRangeIterLazy 3500 3501 +0.0% 1.00x (?)
DropLastAnySequence 5002 5004 +0.0% 1.00x (?)
DropLastAnySequenceLazy 5202 5191 -0.2% 1.00x
DropLastCountableRange 6 6 +0.0% 1.00x
DropLastCountableRangeLazy 6 6 +0.0% 1.00x
DropLastSequence 529 527 -0.4% 1.00x (?)
DropLastSequenceLazy 528 529 +0.2% 1.00x (?)
DropWhileAnyCollection 64 63 -1.6% 1.02x
DropWhileAnyCollectionLazy 82 82 +0.0% 1.00x
DropWhileAnySeqCRangeIter 17273 17244 -0.2% 1.00x
DropWhileAnySeqCRangeIterLazy 82 82 +0.0% 1.00x
DropWhileAnySeqCntRange 35 35 +0.0% 1.00x
DropWhileAnySeqCntRangeLazy 82 82 +0.0% 1.00x
DropWhileAnySequence 5068 4955 -2.2% 1.02x
DropWhileAnySequenceLazy 1966 1966 +0.0% 1.00x
DropWhileArrayLazy 57 57 +0.0% 1.00x
DropWhileCountableRange 19 19 +0.0% 1.00x
DropWhileCountableRangeLazy 59 59 +0.0% 1.00x
DropWhileSequence 2262 2262 +0.0% 1.00x
DropWhileSequenceLazy 46 46 +0.0% 1.00x
EqualStringSubstring 41 41 +0.0% 1.00x
EqualSubstringString 43 44 +2.3% 0.98x
EqualSubstringSubstringGenericEquatable 41 41 +0.0% 1.00x
ErrorHandling 1165 1172 +0.6% 0.99x
ExclusivityGlobal 3 3 +0.0% 1.00x
ExclusivityIndependent 2 2 +0.0% 1.00x
FatCompactMap 204316 204344 +0.0% 1.00x (?)
FilterEvenUsingReduce 1345 1340 -0.4% 1.00x (?)
FilterEvenUsingReduceInto 149 149 +0.0% 1.00x
FloatingPointPrinting_Double_description_small 20957 20888 -0.3% 1.00x (?)
FloatingPointPrinting_Double_description_uniform 20532 20465 -0.3% 1.00x (?)
FloatingPointPrinting_Double_interpolated 61600 61211 -0.6% 1.01x (?)
FloatingPointPrinting_Float80_description_small 28771 28722 -0.2% 1.00x
FloatingPointPrinting_Float80_description_uniform 27795 28114 +1.1% 0.99x (?)
FloatingPointPrinting_Float80_interpolated 65437 65413 -0.0% 1.00x (?)
FloatingPointPrinting_Float_description_small 4845 4847 +0.0% 1.00x (?)
FloatingPointPrinting_Float_description_uniform 4921 4915 -0.1% 1.00x (?)
FloatingPointPrinting_Float_interpolated 37617 37625 +0.0% 1.00x (?)
FrequenciesUsingReduce 4911 4941 +0.6% 0.99x (?)
FrequenciesUsingReduceInto 1513 1524 +0.7% 0.99x
Hanoi 2007 2007 +0.0% 1.00x
HashTest 886 888 +0.2% 1.00x (?)
Histogram 671 676 +0.7% 0.99x
Integrate 317 317 +0.0% 1.00x
IterateData 1415 1415 +0.0% 1.00x
Join 150 151 +0.7% 0.99x (?)
LazilyFilteredArrayContains 34239 34219 -0.1% 1.00x (?)
LazilyFilteredArrays 67089 67720 +0.9% 0.99x (?)
LazilyFilteredRange 3870 3858 -0.3% 1.00x
LessSubstringSubstring 41 41 +0.0% 1.00x
LessSubstringSubstringGenericComparable 43 43 +0.0% 1.00x
LinkedList 8303 8287 -0.2% 1.00x
LuhnAlgoEager 438 438 +0.0% 1.00x
LuhnAlgoLazy 439 443 +0.9% 0.99x
MapReduce 334 334 +0.0% 1.00x
MapReduceAnyCollection 366 366 +0.0% 1.00x
MapReduceAnyCollectionShort 2313 2306 -0.3% 1.00x
MapReduceClass 3056 3051 -0.2% 1.00x (?)
MapReduceClassShort 4633 4637 +0.1% 1.00x (?)
MapReduceLazyCollection 12 12 +0.0% 1.00x
MapReduceLazyCollectionShort 36 36 +0.0% 1.00x
MapReduceLazySequence 90 90 +0.0% 1.00x
MapReduceSequence 446 444 -0.4% 1.00x (?)
MapReduceShort 2042 2050 +0.4% 1.00x (?)
MapReduceShortString 20 20 +0.0% 1.00x
Memset 235 235 +0.0% 1.00x
MonteCarloE 10285 10255 -0.3% 1.00x
MonteCarloPi 43960 43849 -0.3% 1.00x
NSDictionaryCastToSwift 6843 6879 +0.5% 0.99x (?)
NSError 158 159 +0.6% 0.99x (?)
NSStringConversion 596 596 +0.0% 1.00x
NibbleSort 3534 3537 +0.1% 1.00x (?)
NopDeinit 31982 31960 -0.1% 1.00x
ObjectAllocation 134 132 -1.5% 1.02x
ObjectiveCBridgeFromNSArrayAnyObject 23635 23331 -1.3% 1.01x (?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 4301 4307 +0.1% 1.00x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 42706 42581 -0.3% 1.00x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 41368 41056 -0.8% 1.01x (?)
ObjectiveCBridgeFromNSDictionaryAnyObject 92143 91581 -0.6% 1.01x (?)
ObjectiveCBridgeFromNSSetAnyObject 44026 43769 -0.6% 1.01x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 4639 4678 +0.8% 0.99x
ObjectiveCBridgeFromNSSetAnyObjectToString 60557 59958 -1.0% 1.01x (?)
ObjectiveCBridgeFromNSString 1130 1130 +0.0% 1.00x
ObjectiveCBridgeFromNSStringForced 2375 2375 +0.0% 1.00x
ObjectiveCBridgeStubDataAppend 6303 6313 +0.2% 1.00x (?)
ObjectiveCBridgeStubDateMutation 424 424 +0.0% 1.00x
ObjectiveCBridgeStubFromArrayOfNSString 29311 29291 -0.1% 1.00x (?)
ObjectiveCBridgeStubFromNSDate 6113 6118 +0.1% 1.00x (?)
ObjectiveCBridgeStubFromNSString 870 881 +1.3% 0.99x
ObjectiveCBridgeStubFromNSStringRef 141 140 -0.7% 1.01x
ObjectiveCBridgeStubNSDataAppend 2499 2430 -2.8% 1.03x
ObjectiveCBridgeStubNSDateMutationRef 13298 13523 +1.7% 0.98x (?)
ObjectiveCBridgeStubToArrayOfNSString 38621 38985 +0.9% 0.99x (?)
ObjectiveCBridgeStubToNSDate 15770 15446 -2.1% 1.02x (?)
ObjectiveCBridgeStubToNSDateRef 3607 3597 -0.3% 1.00x (?)
ObjectiveCBridgeStubToNSString 2338 2328 -0.4% 1.00x (?)
ObjectiveCBridgeStubToNSStringRef 101 101 +0.0% 1.00x
ObjectiveCBridgeStubURLAppendPath 188384 189034 +0.3% 1.00x (?)
ObjectiveCBridgeStubURLAppendPathRef 191085 189097 -1.0% 1.01x (?)
ObjectiveCBridgeToNSArray 13634 13845 +1.5% 0.98x (?)
ObjectiveCBridgeToNSDictionary 21701 21921 +1.0% 0.99x (?)
ObjectiveCBridgeToNSSet 15559 15243 -2.0% 1.02x (?)
ObjectiveCBridgeToNSString 369 369 +0.0% 1.00x
ObserverClosure 2187 2223 +1.6% 0.98x
ObserverForwarderStruct 1210 1218 +0.7% 0.99x (?)
ObserverPartiallyAppliedMethod 3784 3774 -0.3% 1.00x (?)
ObserverUnappliedMethod 2596 2588 -0.3% 1.00x (?)
OpaqueConsumingUsers 4244 4243 -0.0% 1.00x
OpenClose 57 59 +3.5% 0.97x
PartialApplyDynamicType 0 0 +0.0% 1.00x
Phonebook 6484 6494 +0.2% 1.00x (?)
PointerArithmetics 34445 34482 +0.1% 1.00x (?)
PolymorphicCalls 17 17 +0.0% 1.00x
PopFrontArray 1238 1257 +1.5% 0.98x (?)
PopFrontArrayGeneric 1275 1274 -0.1% 1.00x (?)
PopFrontUnsafePointer 6162 6163 +0.0% 1.00x (?)
PrefixAnyCollection 51 51 +0.0% 1.00x
PrefixAnyCollectionLazy 66132 66518 +0.6% 0.99x (?)
PrefixAnySeqCRangeIter 17107 17111 +0.0% 1.00x (?)
PrefixAnySeqCRangeIterLazy 17108 17107 -0.0% 1.00x (?)
PrefixAnySeqCntRange 26 26 +0.0% 1.00x
PrefixAnySeqCntRangeLazy 26 26 +0.0% 1.00x
PrefixAnySequence 4205 4202 -0.1% 1.00x (?)
PrefixAnySequenceLazy 4173 4204 +0.7% 0.99x
PrefixArray 30 30 +0.0% 1.00x
PrefixArrayLazy 30 30 +0.0% 1.00x
PrefixCountableRange 18 18 +0.0% 1.00x
PrefixCountableRangeLazy 19 19 +0.0% 1.00x
PrefixSequence 2374 2373 -0.0% 1.00x (?)
PrefixSequenceLazy 2448 2448 +0.0% 1.00x
PrefixWhileAnyCollection 89 89 +0.0% 1.00x
PrefixWhileAnyCollectionLazy 52 52 +0.0% 1.00x
PrefixWhileAnySeqCRangeIter 8724 8719 -0.1% 1.00x (?)
PrefixWhileAnySeqCRangeIterLazy 58 58 +0.0% 1.00x
PrefixWhileAnySeqCntRange 45 44 -2.2% 1.02x
PrefixWhileAnySeqCntRangeLazy 52 52 +0.0% 1.00x
PrefixWhileAnySequence 9957 9961 +0.0% 1.00x (?)
PrefixWhileAnySequenceLazy 1494 1494 +0.0% 1.00x
PrefixWhileArray 68 68 +0.0% 1.00x
PrefixWhileArrayLazy 37 37 +0.0% 1.00x
PrefixWhileCountableRange 28 28 +0.0% 1.00x
PrefixWhileCountableRangeLazy 18 18 +0.0% 1.00x
PrefixWhileSequence 308 308 +0.0% 1.00x
PrefixWhileSequenceLazy 28 28 +0.0% 1.00x
Prims 908 911 +0.3% 1.00x
PrimsSplit 913 908 -0.5% 1.01x (?)
QueueConcrete 1166 1167 +0.1% 1.00x (?)
QueueGeneric 1163 1162 -0.1% 1.00x (?)
RC4 168 168 +0.0% 1.00x
RGBHistogram 3143 3139 -0.1% 1.00x (?)
RGBHistogramOfObjects 24183 24214 +0.1% 1.00x (?)
Radix2CooleyTukey 12725 12942 +1.7% 0.98x (?)
Radix2CooleyTukeyf 9993 9998 +0.1% 1.00x (?)
RandomDoubleDef 23247 23257 +0.0% 1.00x (?)
RandomDoubleLCG 3166 3166 +0.0% 1.00x
RandomIntegersDef 21176 21188 +0.1% 1.00x (?)
RandomIntegersLCG 1012 1012 +0.0% 1.00x
RandomShuffleDef 835684 835407 -0.0% 1.00x (?)
RandomShuffleLCG 264420 264934 +0.2% 1.00x (?)
RangeAssignment 302 301 -0.3% 1.00x (?)
RangeIterationSigned 134 135 +0.7% 0.99x (?)
RangeReplaceableCollectionPlusDefault 1022 1018 -0.4% 1.00x (?)
RecursiveOwnedParameter 81 81 +0.0% 1.00x
RemoveWhereFilterInts 39 39 +0.0% 1.00x
RemoveWhereFilterString 233 233 +0.0% 1.00x
RemoveWhereFilterStrings 440 439 -0.2% 1.00x
RemoveWhereMoveInts 13 13 +0.0% 1.00x
RemoveWhereMoveStrings 739 740 +0.1% 1.00x (?)
RemoveWhereQuadraticInts 1213 1216 +0.2% 1.00x
RemoveWhereQuadraticString 367 366 -0.3% 1.00x
RemoveWhereQuadraticStrings 2926 2927 +0.0% 1.00x (?)
RemoveWhereSwapInts 18 18 +0.0% 1.00x
RemoveWhereSwapStrings 880 881 +0.1% 1.00x (?)
ReversedArray 52 51 -1.9% 1.02x
ReversedBidirectional 17216 17232 +0.1% 1.00x (?)
ReversedDictionary 249 248 -0.4% 1.00x (?)
RomanNumbers 78767 78936 +0.2% 1.00x
SequenceAlgosAnySequence 12238 12236 -0.0% 1.00x (?)
SequenceAlgosArray 1654 1668 +0.8% 0.99x (?)
SequenceAlgosContiguousArray 1708 1676 -1.9% 1.02x (?)
SequenceAlgosList 1533 1537 +0.3% 1.00x (?)
SequenceAlgosRange 2273 2273 +0.0% 1.00x
SequenceAlgosUnfoldSequence 1114 1114 +0.0% 1.00x
SetExclusiveOr 4855 4858 +0.1% 1.00x (?)
SetExclusiveOr_OfObjects 11653 11686 +0.3% 1.00x (?)
SetIntersect 688 686 -0.3% 1.00x (?)
SetIntersect_OfObjects 1774 1803 +1.6% 0.98x
SetIsSubsetOf 359 347 -3.3% 1.03x
SetIsSubsetOf_OfObjects 468 484 +3.4% 0.97x
SetUnion 4251 4326 +1.8% 0.98x (?)
SetUnion_OfObjects 10208 10158 -0.5% 1.00x (?)
SevenBoom 808 808 +0.0% 1.00x
Sim2DArray 363 363 +0.0% 1.00x
SortLargeExistentials 5344 5332 -0.2% 1.00x (?)
SortLettersInPlace 1050 1057 +0.7% 0.99x
SortSortedStrings 806 807 +0.1% 1.00x (?)
SortStrings 1720 1722 +0.1% 1.00x (?)
SortStringsUnicode 2315 2305 -0.4% 1.00x
StackPromo 25005 25038 +0.1% 1.00x (?)
StrComplexWalk 1424 1423 -0.1% 1.00x
StrToInt 2839 2854 +0.5% 0.99x
StringAdder 485 482 -0.6% 1.01x
StringBuilder 407 407 +0.0% 1.00x
StringBuilderLong 1288 1288 +0.0% 1.00x
StringBuilderSmallReservingCapacity 420 420 +0.0% 1.00x
StringBuilderWithLongSubstring 1458 1460 +0.1% 1.00x (?)
StringComparison_abnormal 783 784 +0.1% 1.00x (?)
StringComparison_ascii 967 969 +0.2% 1.00x (?)
StringComparison_emoji 797 800 +0.4% 1.00x
StringComparison_fastPrenormal 720 721 +0.1% 1.00x
StringComparison_latin1 566 567 +0.2% 1.00x
StringComparison_longSharedPrefix 721 721 +0.0% 1.00x
StringComparison_nonBMPSlowestPrenormal 1555 1561 +0.4% 1.00x
StringComparison_slowerPrenormal 1657 1662 +0.3% 1.00x (?)
StringComparison_zalgo 98308 97870 -0.4% 1.00x (?)
StringEdits 168027 169759 +1.0% 0.99x (?)
StringEnumRawValueInitialization 843 843 +0.0% 1.00x
StringEqualPointerComparison 272 272 +0.0% 1.00x
StringFromLongWholeSubstring 22 22 +0.0% 1.00x
StringFromLongWholeSubstringGeneric 21 21 +0.0% 1.00x
StringHasPrefixAscii 1864 1846 -1.0% 1.01x
StringHasPrefixUnicode 96078 96028 -0.1% 1.00x (?)
StringHasSuffixAscii 1976 1927 -2.5% 1.03x
StringHasSuffixUnicode 98460 98330 -0.1% 1.00x (?)
StringInterpolation 9123 9115 -0.1% 1.00x (?)
StringInterpolationManySmallSegments 17548 17493 -0.3% 1.00x (?)
StringInterpolationSmall 3960 3952 -0.2% 1.00x
StringMatch 11983 12014 +0.3% 1.00x
StringRemoveDupes 477 479 +0.4% 1.00x (?)
StringUTF16Builder 2673 2649 -0.9% 1.01x (?)
StringUTF16SubstringBuilder 5542 5531 -0.2% 1.00x (?)
StringWalk 1426 1427 +0.1% 1.00x
StringWithCString 39946 39930 -0.0% 1.00x (?)
StringWordBuilder 2329 2331 +0.1% 1.00x (?)
StringWordBuilderReservingCapacity 1724 1722 -0.1% 1.00x (?)
SubstringComparable 11 11 +0.0% 1.00x
SubstringEqualString 599 599 +0.0% 1.00x
SubstringEquatable 1353 1351 -0.1% 1.00x
SubstringFromLongString 11 11 +0.0% 1.00x
SubstringFromLongStringGeneric 76 76 +0.0% 1.00x
SuffixAnyCollection 26 26 +0.0% 1.00x
SuffixAnyCollectionLazy 22052 22020 -0.1% 1.00x (?)
SuffixAnySeqCRangeIter 3742 3747 +0.1% 1.00x (?)
SuffixAnySeqCRangeIterLazy 3753 3746 -0.2% 1.00x (?)
SuffixAnySeqCntRange 17 17 +0.0% 1.00x
SuffixAnySeqCntRangeLazy 17 17 +0.0% 1.00x
SuffixAnySequence 5092 5091 -0.0% 1.00x (?)
SuffixAnySequenceLazy 5288 5290 +0.0% 1.00x (?)
SuffixCountableRange 6 6 +0.0% 1.00x
SuffixCountableRangeLazy 6 6 +0.0% 1.00x
SuffixSequence 3619 3619 +0.0% 1.00x
SuffixSequenceLazy 3621 3621 +0.0% 1.00x
SumUsingReduce 96 96 +0.0% 1.00x
SumUsingReduceInto 97 97 +0.0% 1.00x
SuperChars 15975 15987 +0.1% 1.00x (?)
TwoSum 1416 1421 +0.4% 1.00x (?)
TypeFlood 0 0 +0.0% 1.00x
UTF8Decode 257 258 +0.4% 1.00x (?)
UTF8Decode_InitDecoding 1150 1153 +0.3% 1.00x (?)
UTF8Decode_InitDecoding_ascii 1896 1899 +0.2% 1.00x (?)
UTF8Decode_InitFromBytes 1117 1118 +0.1% 1.00x (?)
UTF8Decode_InitFromBytes_ascii 463 470 +1.5% 0.99x (?)
UTF8Decode_InitFromData 1164 1162 -0.2% 1.00x (?)
UTF8Decode_InitFromData_ascii 633 631 -0.3% 1.00x (?)
Walsh 372 372 +0.0% 1.00x
WordCountHistogramASCII 7682 7655 -0.4% 1.00x
WordCountHistogramUTF16 13318 13448 +1.0% 0.99x (?)
WordCountUniqueASCII 2031 2007 -1.2% 1.01x (?)
WordCountUniqueUTF16 7142 7155 +0.2% 1.00x (?)
WordSplitASCII 6051 6055 +0.1% 1.00x (?)
WordSplitUTF16 7261 7146 -1.6% 1.02x (?)
XorLoop 352 353 +0.3% 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

@gottesmm
Copy link
Contributor

Same!

@lorentey
Copy link
Member Author

@swift-ci please smoke test linux platform

@lorentey lorentey merged commit fb541ad into swiftlang:master Jun 18, 2018
@lorentey lorentey deleted the benchmark32 branch June 18, 2018 12:33
@palimondo
Copy link
Contributor

palimondo commented Jul 13, 2018

@lorentey @gottesmm @eeckstein I'm curious about the possibility of scale to overflow on 32-bit system this commit addresses. How are using the --iter-scale parameter in your internal tooling?

Looking at the code, I would have thought the only potential for overflow is on line 395:

scale = UInt(time_per_sample / elapsed_time)

if the elapsed time is very low (worst case: 1 microsecond) it would take a manual setting of iter-scale to 4294 to overflow UInt32. Why would anyone want to run a single microbenchmark for 71 minutes?

I'm asking because I'm about to refactor the surrounding code and plan to replace all the exotic type selections (UInt64, UInt) with idiomatic Swift which uses simple platform dependent Int. I figure that the capacity for running a single micro-benchmark for 35 minutes on the 32-bit platforms is plenty enough, but I'd rather not overlook your internal use-case.

For the record, this is how I'm doing the estimates:

Max Capacity UInt64 Int64 UInt32 Int32
microseconds 18446744073709551615 9223372036854775807 4294967295 2147483647
seconds 18446744073709 9223372036854 4294 2147
minutes 307445734561 153722867280 71 35
hours 5124095576 2562047788 1
days 213503982 106751991
years 584942 292471
centuries 5849 2924
millenia 584 292

So the explicit use of UInt64 to track the runtimes of microbenchmarks strikes me as quite ridiculous.

@lorentey
Copy link
Member Author

There are some imperfect benchmarks in this suite that take effectively zero time, independent of the scale factor given to them. Most likely the 1 ... N loop gets optimized away entirely, and these benchmarks aren't measuring anything useful. So elapsed_time can be as low as a handful of nanoseconds.

However, the overflows I work around here happened in the benchmarks themselves, when they multiply the scaling factor with their own constants, which can be as high as 10,000 (or even 100,000 in places). Without the artificial limit I added, some benchmarks do try to run more than 2^31 iterations on 32-bit platforms (e.g., the i386 simulator).

@atrick
Copy link
Contributor

atrick commented Jul 13, 2018

There is nothing exotic about specifying the bitwidth of an integer. It's the appropriate thing to do in code that performs measurement and computation. Introducing platform specific behavior in the benchmark driver is not appropriate.

@palimondo
Copy link
Contributor

palimondo commented Jul 13, 2018

@lorentey Oh I see: You're just putting an upper bound on the i passed down to each runFunction, so they don't overflow when computing the inner loop multiplier internally. Makes perfect sense. Thank you for the clarification!

@atrick I agree that it is important to be specific about integer width when it serves a concrete purpose. But Int-type choices in many parts of the benchmark driver are rather arbitrary and obfuscate more than clarify. Most of what I've seen so far would work safely with the capacity of Int32 and would be therefore just fine with idiomatic plain old Int. When it comes to these modifications, I'll make sure to ask for your review. Thank you for the vigilance!

So, do you know of any internal use of the --iter-scale parameter? When and how is it used in practice?

palimondo added a commit to palimondo/swift that referenced this pull request Aug 31, 2018
Clarified the need for capping `numIters` according to the discussion at swiftlang#17268 (comment)

The sampling loop is a hairy piece of code, because it’s trying to reuse the calibration measurement as a regular sample, in case the computed `numIters` turns out to be 1. But it conflicts with the case when `fixedNumIters` is 1, necessitating a separate measurement in the else branch… That was a quick fix back then, but its hard to make it clean. More thinking is required…
palimondo added a commit to palimondo/swift that referenced this pull request Sep 14, 2018
Clarified the need for capping `numIters` according to the discussion at swiftlang#17268 (comment)

The sampling loop is a hairy piece of code, because it’s trying to reuse the calibration measurement as a regular sample, in case the computed `numIters` turns out to be 1. But it conflicts with the case when `fixedNumIters` is 1, necessitating a separate measurement in the else branch… That was a quick fix back then, but its hard to make it clean. More thinking is required…
dcci pushed a commit that referenced this pull request Sep 17, 2018
Clarified the need for capping `numIters` according to the discussion at #17268 (comment)

The sampling loop is a hairy piece of code, because it’s trying to reuse the calibration measurement as a regular sample, in case the computed `numIters` turns out to be 1. But it conflicts with the case when `fixedNumIters` is 1, necessitating a separate measurement in the else branch… That was a quick fix back then, but its hard to make it clean. More thinking is required…
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.

6 participants