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

[stdlib] optimise DefaultIndices.contains because it is sorted. #15377

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@kareman
Copy link

kareman commented Mar 20, 2018

Currently DefaultIndices uses Sequence.contains, which starts from the beginning and checks equality with each index until it finds a match and returns true, or reaches the end and returns false. But the indices of collections are by definition sorted. This commit overrides contains(_ element: Element) with a method which returns false immediately if ‘element’ is not less than endIndex. It then goes through each index from the beginning and returns false as soon as it reaches an index that is larger than ‘element’.

The result is the expected on-average 2x performance improvement when searching for invalid indices that are in the range startIndex..<endIndex (tested with Attabench on Swift 4.0.3, as that is the latest version Attabench supports). I used strings for the tests.

To test unit test coverage I tried always returning false. That led to failures in unit tests stdlib/NSSlowString.swift, stdlib/NSStringAPI.swift and stdlib/Runtime.swift.gyb. Always returning true did not lead to any failures.

[stdlib] optimise DefaultIndices.contains because it is sorted.
Currently DefaultIndices uses Sequence.contains, which starts from the beginning and checks equality with each index until it finds a match and returns true, or reaches the end and returns false. But the indices of collections are by definition sorted. This commit adds a `contains(_ element: Element)` method which returns false immediately if ‘element’ is not less than endIndex. It then goes through each index from the beginning and returns false as soon as it reaches an index that is larger than ‘element’.
@kareman

This comment has been minimized.

Copy link

kareman commented Mar 20, 2018

You could also improve performance further for DefaultIndices of RandomAccessCollections by using binary search.

I think, but I haven't tested this, the performance for DefaultIndices of String could be improved even further by just returning String.Index(element, within: _elements) != nil.

@airspeedswift

This comment has been minimized.

Copy link
Member

airspeedswift commented Mar 20, 2018

Relatedly/ideally, Indices would conform to RangeExpression too.

@kareman

This comment has been minimized.

Copy link

kareman commented Mar 20, 2018

Yes that makes sense.

@jrose-apple

This comment has been minimized.

Copy link
Member

jrose-apple commented Mar 20, 2018

Given that Comparable is supposed to implement total ordering "except for exceptional cases", do you even need to check anything other than the start and end indexes?

@kareman

This comment has been minimized.

Copy link

kareman commented Mar 20, 2018

Yes, even if an index is between the start and end indices it is not necessarily a valid index into the collection. Strings in particular have this problem where an index can point to the middle of a character (like its second UnicodeScalar). That index could have come from the string's .unicodeScalars view.

@jrose-apple

This comment has been minimized.

Copy link
Member

jrose-apple commented Mar 20, 2018

Uh…ick. Thanks.

@jrose-apple

This comment has been minimized.

Copy link
Member

jrose-apple commented Mar 20, 2018

I guess the stride-collections have a similar problem.

@kareman

This comment has been minimized.

Copy link

kareman commented Mar 21, 2018

@airspeedswift If DefaultIndices conforms to RangeExpression, and DefaultIndices being a collection that is not Strideable, will it not have to answer two different and incompatible questions with the same method? RangeExpression.contains asks "is lowerBound <= element && element < upperBound?", whereas Collection.contains asks "is this element in this collection?".

@airspeedswift

This comment has been minimized.

Copy link
Member

airspeedswift commented Mar 21, 2018

Hmm, I see what you mean. I think it's an issue with the documentation for RangeExpression. I don't see a problem with DefaultIndices conforming to RangeExpression and implementing contains the way you describe, that seems like the right behavior, but the docs for the protocol suggest it's supposed to do a simple range change. My preference would be to update the docs, tho.

@jrose-apple

This comment has been minimized.

Copy link
Member

jrose-apple commented Mar 21, 2018

I'd be very surprised if RangeExpression.contains was ever not O(1). That would lead to me not using it as my generic bound.

@kareman

This comment has been minimized.

Copy link

kareman commented Mar 21, 2018

That’s a good point, I’ve always thought of Range as the archetypical RangeExpression, and RangeExpression.contains implies a simple bounds check.

@@ -82,6 +82,16 @@ extension DefaultIndices: Collection {
public var indices: Indices {
return self
}

public func contains(_ element: Element) -> Bool {

This comment has been minimized.

@natecook1000

natecook1000 Mar 22, 2018

Member

Can you add this as _customContainsEquatableElement(_:) -> Bool? instead of contains(_:) -> Bool? That way the optimization will still get used in generic contexts.

This comment has been minimized.

@kareman

kareman Mar 23, 2018

Sure.

@kareman

This comment has been minimized.

Copy link

kareman commented Apr 3, 2018

The method in this PR must in any case be defined on DefaultIndices as it needs access to the collection. Can this PR be considered separately from the RangeExpression conformance question?

@natecook1000

This comment has been minimized.

Copy link
Member

natecook1000 commented Apr 3, 2018

@swift-ci Please smoke test

@kareman

This comment has been minimized.

Copy link

kareman commented May 13, 2018

It would be interesting to see what effect this has in the benchmarks.

@airspeedswift

This comment has been minimized.

Copy link
Member

airspeedswift commented May 24, 2018

@swift-ci please smoke benchmark

@airspeedswift

This comment has been minimized.

Copy link
Member

airspeedswift commented May 24, 2018

I'd be (pleasantly) surprised if any benchmarks exercised this path, but let's see.

@gottesmm

This comment has been minimized.

Copy link
Member

gottesmm commented May 25, 2018

@airspeedswift sounds like we need a new benchmark ; ).

@swift-ci

This comment has been minimized.

Copy link
Contributor

swift-ci commented May 25, 2018

Build comment file:

Optimized (O)

Regression (8)
TEST OLD NEW DELTA SPEEDUP
StringBuilderWithLongSubstring 1476 1996 +35.2% 0.74x
StringBuilderLong 1250 1497 +19.8% 0.84x (?)
DictionaryKeysContainsCocoa 40 45 +12.5% 0.89x
EqualSubstringString 49 53 +8.2% 0.92x
ObjectiveCBridgeFromNSArrayAnyObjectForced 4692 5056 +7.8% 0.93x (?)
DataAppendDataSmallToMedium 7443 7993 +7.4% 0.93x (?)
DataMutateBytes 4200 4448 +5.9% 0.94x
DataAppendDataSmallToSmall 6771 7156 +5.7% 0.95x (?)
Improvement (6)
TEST OLD NEW DELTA SPEEDUP
DictionarySubscriptDefaultMutationArray 700 638 -8.9% 1.10x (?)
DataReplaceSmall 9681 8917 -7.9% 1.09x
ObjectiveCBridgeStubFromArrayOfNSString 38395 35397 -7.8% 1.08x
DataAppendDataMediumToMedium 8710 8040 -7.7% 1.08x (?)
DataReplaceMedium 13354 12629 -5.4% 1.06x
ObjectiveCBridgeStubURLAppendPathRef 293926 279161 -5.0% 1.05x (?)
No Changes (422)
TEST OLD NEW DELTA SPEEDUP
AngryPhonebook 3761 3618 -3.8% 1.04x (?)
AnyHashableWithAClass 86028 86389 +0.4% 1.00x (?)
Array2D 2856 2851 -0.2% 1.00x (?)
ArrayAppend 1114 1102 -1.1% 1.01x (?)
ArrayAppendArrayOfInt 796 794 -0.3% 1.00x (?)
ArrayAppendAscii 4038 4002 -0.9% 1.01x (?)
ArrayAppendAsciiSubstring 45854 45824 -0.1% 1.00x (?)
ArrayAppendFromGeneric 798 800 +0.3% 1.00x (?)
ArrayAppendGenericStructs 1425 1425 +0.0% 1.00x
ArrayAppendLatin1 41131 41477 +0.8% 0.99x
ArrayAppendLatin1Substring 194271 195306 +0.5% 0.99x
ArrayAppendLazyMap 1340 1342 +0.1% 1.00x (?)
ArrayAppendOptionals 1423 1425 +0.1% 1.00x (?)
ArrayAppendRepeatCol 1338 1340 +0.1% 1.00x (?)
ArrayAppendReserved 839 838 -0.1% 1.00x (?)
ArrayAppendSequence 1120 1121 +0.1% 1.00x (?)
ArrayAppendStrings 6332 6333 +0.0% 1.00x (?)
ArrayAppendToFromGeneric 799 798 -0.1% 1.00x (?)
ArrayAppendToGeneric 799 800 +0.1% 1.00x (?)
ArrayAppendUTF16 40378 41312 +2.3% 0.98x
ArrayAppendUTF16Substring 196268 198387 +1.1% 0.99x
ArrayInClass 85 86 +1.2% 0.99x
ArrayLiteral 0 0 +0.0% 1.00x
ArrayOfGenericPOD2 151 151 +0.0% 1.00x
ArrayOfGenericRef 4382 4373 -0.2% 1.00x (?)
ArrayOfPOD 184 185 +0.5% 0.99x
ArrayOfRef 4354 4349 -0.1% 1.00x (?)
ArrayPlusEqualArrayOfInt 788 796 +1.0% 0.99x
ArrayPlusEqualFiveElementCollection 5564 5565 +0.0% 1.00x (?)
ArrayPlusEqualSingleElementCollection 1115 1113 -0.2% 1.00x
ArrayPlusEqualThreeElements 1653 1654 +0.1% 1.00x (?)
ArraySubscript 1547 1546 -0.1% 1.00x (?)
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
BinaryFloatingPointPropertiesBinade 25 25 +0.0% 1.00x
BinaryFloatingPointPropertiesNextUp 28 28 +0.0% 1.00x
BinaryFloatingPointPropertiesUlp 35 35 +0.0% 1.00x
BitCount 202 202 +0.0% 1.00x
ByteSwap 106 107 +0.9% 0.99x
COWTree 5362 5375 +0.2% 1.00x (?)
CSVParsing 694054 695080 +0.1% 1.00x (?)
CSVParsingAlt 782605 781058 -0.2% 1.00x (?)
CSVParsingAltIndices 335506 334177 -0.4% 1.00x (?)
CStringLongAscii 4210 4221 +0.3% 1.00x
CStringLongNonAscii 2535 2522 -0.5% 1.01x
CStringShortAscii 3332 3350 +0.5% 0.99x (?)
Calculator 1194 1173 -1.8% 1.02x
CaptureProp 4119 4110 -0.2% 1.00x (?)
ChainedFilterMap 1247 1249 +0.2% 1.00x (?)
CharIndexing_ascii_unicodeScalars 16327 16321 -0.0% 1.00x (?)
CharIndexing_ascii_unicodeScalars_Backwards 16259 16262 +0.0% 1.00x (?)
CharIndexing_chinese_unicodeScalars 12355 12365 +0.1% 1.00x (?)
CharIndexing_chinese_unicodeScalars_Backwards 12347 12341 -0.0% 1.00x (?)
CharIndexing_japanese_unicodeScalars 19512 19528 +0.1% 1.00x (?)
CharIndexing_japanese_unicodeScalars_Backwards 19424 19448 +0.1% 1.00x (?)
CharIndexing_korean_unicodeScalars 15864 15808 -0.4% 1.00x
CharIndexing_korean_unicodeScalars_Backwards 15802 15780 -0.1% 1.00x (?)
CharIndexing_punctuatedJapanese_unicodeScalars 2966 2960 -0.2% 1.00x (?)
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 2964 2959 -0.2% 1.00x (?)
CharIndexing_punctuated_unicodeScalars 3706 3706 +0.0% 1.00x
CharIndexing_punctuated_unicodeScalars_Backwards 3700 3696 -0.1% 1.00x (?)
CharIndexing_russian_unicodeScalars 13610 13608 -0.0% 1.00x (?)
CharIndexing_russian_unicodeScalars_Backwards 13571 13556 -0.1% 1.00x (?)
CharIndexing_tweet_unicodeScalars 32180 32187 +0.0% 1.00x (?)
CharIndexing_tweet_unicodeScalars_Backwards 32231 32190 -0.1% 1.00x (?)
CharIndexing_utf16_unicodeScalars 22963 22966 +0.0% 1.00x (?)
CharIndexing_utf16_unicodeScalars_Backwards 23675 23682 +0.0% 1.00x (?)
CharIteration_ascii_unicodeScalars 20642 20359 -1.4% 1.01x
CharIteration_ascii_unicodeScalars_Backwards 14755 14743 -0.1% 1.00x (?)
CharIteration_chinese_unicodeScalars 16085 15414 -4.2% 1.04x
CharIteration_chinese_unicodeScalars_Backwards 11504 11176 -2.9% 1.03x
CharIteration_japanese_unicodeScalars 24680 24339 -1.4% 1.01x
CharIteration_japanese_unicodeScalars_Backwards 17655 17642 -0.1% 1.00x (?)
CharIteration_korean_unicodeScalars 20029 19752 -1.4% 1.01x
CharIteration_korean_unicodeScalars_Backwards 14300 14297 -0.0% 1.00x (?)
CharIteration_punctuatedJapanese_unicodeScalars 3751 3640 -3.0% 1.03x
CharIteration_punctuatedJapanese_unicodeScalars_Backwards 2679 2681 +0.1% 1.00x (?)
CharIteration_punctuated_unicodeScalars 4672 4582 -1.9% 1.02x
CharIteration_punctuated_unicodeScalars_Backwards 3351 3351 +0.0% 1.00x
CharIteration_russian_unicodeScalars 17172 16949 -1.3% 1.01x
CharIteration_russian_unicodeScalars_Backwards 12285 12282 -0.0% 1.00x (?)
CharIteration_tweet_unicodeScalars 40407 40042 -0.9% 1.01x
CharIteration_tweet_unicodeScalars_Backwards 29104 29118 +0.0% 1.00x (?)
CharIteration_utf16_unicodeScalars 27728 27669 -0.2% 1.00x
CharIteration_utf16_unicodeScalars_Backwards 17822 17832 +0.1% 1.00x (?)
CharacterLiteralsLarge 5914 5929 +0.3% 1.00x (?)
CharacterLiteralsSmall 217 217 +0.0% 1.00x
CharacterPropertiesFetch 4544 4529 -0.3% 1.00x (?)
CharacterPropertiesPrecomputed 1100 1099 -0.1% 1.00x (?)
CharacterPropertiesStashed 1469 1471 +0.1% 1.00x (?)
CharacterPropertiesStashedMemo 1576 1549 -1.7% 1.02x
Chars 1093 1094 +0.1% 1.00x
ClassArrayGetter 15 15 +0.0% 1.00x
Combos 491 493 +0.4% 1.00x
DataAccessBytes 1144 1143 -0.1% 1.00x (?)
DataAppendArray 6411 6165 -3.8% 1.04x (?)
DataAppendBytes 5986 5923 -1.1% 1.01x (?)
DataAppendDataLargeToLarge 69928 71041 +1.6% 0.98x
DataAppendDataLargeToMedium 36311 36977 +1.8% 0.98x (?)
DataAppendDataLargeToSmall 35234 35421 +0.5% 0.99x (?)
DataAppendDataMediumToLarge 39600 39397 -0.5% 1.01x (?)
DataAppendDataMediumToSmall 7097 7253 +2.2% 0.98x (?)
DataAppendDataSmallToLarge 38637 38692 +0.1% 1.00x (?)
DataAppendSequence 21012 20876 -0.6% 1.01x (?)
DataCopyBytes 2513 2568 +2.2% 0.98x
DataCount 38 38 +0.0% 1.00x
DataReplaceLarge 42069 42763 +1.6% 0.98x (?)
DataReplaceLargeBuffer 61530 60413 -1.8% 1.02x (?)
DataReplaceMediumBuffer 15455 15846 +2.5% 0.98x (?)
DataReplaceSmallBuffer 12403 12546 +1.2% 0.99x (?)
DataReset 3196 3268 +2.3% 0.98x (?)
DataSetCount 888 887 -0.1% 1.00x (?)
DataSubscript 237 237 +0.0% 1.00x
DictOfArraysToArrayOfDicts 805 814 +1.1% 0.99x (?)
Dictionary 676 678 +0.3% 1.00x (?)
Dictionary2 809 816 +0.9% 0.99x
Dictionary2OfObjects 2237 2238 +0.0% 1.00x (?)
Dictionary3 254 252 -0.8% 1.01x
Dictionary3OfObjects 770 767 -0.4% 1.00x (?)
Dictionary4 342 344 +0.6% 0.99x
Dictionary4Legacy 730 730 +0.0% 1.00x
Dictionary4OfObjects 453 451 -0.4% 1.00x
Dictionary4OfObjectsLegacy 939 937 -0.2% 1.00x
DictionaryBridge 1249 1219 -2.4% 1.02x (?)
DictionaryCopy 105933 106002 +0.1% 1.00x (?)
DictionaryFilter 105443 105450 +0.0% 1.00x (?)
DictionaryGroup 216 216 +0.0% 1.00x
DictionaryGroupOfObjects 2132 2145 +0.6% 0.99x (?)
DictionaryKeysContainsNative 32 32 +0.0% 1.00x
DictionaryLiteral 1926 1955 +1.5% 0.99x (?)
DictionaryOfObjects 2495 2495 +0.0% 1.00x
DictionaryRemove 4229 4256 +0.6% 0.99x (?)
DictionaryRemoveOfObjects 26181 26123 -0.2% 1.00x (?)
DictionarySubscriptDefaultMutation 267 269 +0.7% 0.99x
DictionarySubscriptDefaultMutationArrayOfObjects 4021 4016 -0.1% 1.00x (?)
DictionarySubscriptDefaultMutationOfObjects 1711 1721 +0.6% 0.99x (?)
DictionarySwap 1030 1030 +0.0% 1.00x
DictionarySwapAt 7136 7127 -0.1% 1.00x (?)
DictionarySwapAtOfObjects 51930 52042 +0.2% 1.00x (?)
DictionarySwapOfObjects 8877 8820 -0.6% 1.01x (?)
DoubleWidthDivision 0 0 +0.0% 1.00x
DropFirstAnyCollection 84 84 +0.0% 1.00x
DropFirstAnyCollectionLazy 64251 63903 -0.5% 1.01x (?)
DropFirstAnySeqCRangeIter 21741 21558 -0.8% 1.01x
DropFirstAnySeqCRangeIterLazy 21747 21591 -0.7% 1.01x (?)
DropFirstAnySeqCntRange 41 41 +0.0% 1.00x
DropFirstAnySeqCntRangeLazy 41 41 +0.0% 1.00x
DropFirstAnySequence 5000 4986 -0.3% 1.00x
DropFirstAnySequenceLazy 4973 4987 +0.3% 1.00x (?)
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 2684 +0.1% 1.00x
DropFirstSequenceLazy 2775 2775 +0.0% 1.00x
DropLastAnyCollection 31 31 +0.0% 1.00x
DropLastAnyCollectionLazy 20778 20846 +0.3% 1.00x (?)
DropLastAnySeqCRangeIter 3521 3520 -0.0% 1.00x (?)
DropLastAnySeqCRangeIterLazy 3532 3520 -0.3% 1.00x
DropLastAnySeqCntRange 13 13 +0.0% 1.00x
DropLastAnySeqCntRangeLazy 13 13 +0.0% 1.00x
DropLastAnySequence 4920 4922 +0.0% 1.00x (?)
DropLastAnySequenceLazy 5009 5010 +0.0% 1.00x (?)
DropLastCountableRange 11 11 +0.0% 1.00x
DropLastCountableRangeLazy 12 12 +0.0% 1.00x
DropLastSequence 629 629 +0.0% 1.00x
DropLastSequenceLazy 629 628 -0.2% 1.00x (?)
DropWhileAnyCollection 107 107 +0.0% 1.00x
DropWhileAnyCollectionLazy 125 125 +0.0% 1.00x
DropWhileAnySeqCRangeIter 17222 17094 -0.7% 1.01x (?)
DropWhileAnySeqCRangeIterLazy 125 125 +0.0% 1.00x
DropWhileAnySeqCntRange 50 51 +2.0% 0.98x
DropWhileAnySeqCntRangeLazy 125 125 +0.0% 1.00x
DropWhileAnySequence 4937 4917 -0.4% 1.00x
DropWhileAnySequenceLazy 1856 1856 +0.0% 1.00x
DropWhileArrayLazy 88 88 +0.0% 1.00x
DropWhileCountableRange 36 36 +0.0% 1.00x
DropWhileCountableRangeLazy 105 105 +0.0% 1.00x
DropWhileSequence 2223 2223 +0.0% 1.00x
DropWhileSequenceLazy 88 88 +0.0% 1.00x
EqualStringSubstring 51 51 +0.0% 1.00x
EqualSubstringSubstring 51 52 +2.0% 0.98x
EqualSubstringSubstringGenericEquatable 49 49 +0.0% 1.00x
ErrorHandling 1602 1606 +0.2% 1.00x (?)
ExclusivityGlobal 5 5 +0.0% 1.00x
ExclusivityIndependent 2 2 +0.0% 1.00x
FatCompactMap 199113 199766 +0.3% 1.00x
FilterEvenUsingReduce 1314 1316 +0.2% 1.00x (?)
FilterEvenUsingReduceInto 147 147 +0.0% 1.00x
FloatingPointPrinting_Double_description_small 23666 23675 +0.0% 1.00x (?)
FloatingPointPrinting_Double_description_uniform 23324 23301 -0.1% 1.00x (?)
FloatingPointPrinting_Double_interpolated 68332 67529 -1.2% 1.01x
FloatingPointPrinting_Float80_description_small 30702 30775 +0.2% 1.00x (?)
FloatingPointPrinting_Float80_description_uniform 29744 29670 -0.2% 1.00x (?)
FloatingPointPrinting_Float80_interpolated 71809 71364 -0.6% 1.01x (?)
FloatingPointPrinting_Float_description_small 5562 5558 -0.1% 1.00x
FloatingPointPrinting_Float_description_uniform 5296 5053 -4.6% 1.05x
FloatingPointPrinting_Float_interpolated 42767 42387 -0.9% 1.01x
FrequenciesUsingReduce 5082 4941 -2.8% 1.03x (?)
FrequenciesUsingReduceInto 1547 1549 +0.1% 1.00x (?)
Hanoi 2275 2273 -0.1% 1.00x (?)
HashTest 1065 1075 +0.9% 0.99x
Histogram 703 702 -0.1% 1.00x (?)
Integrate 334 334 +0.0% 1.00x
IterateData 1500 1499 -0.1% 1.00x (?)
Join 167 166 -0.6% 1.01x
LazilyFilteredArrayContains 37494 37456 -0.1% 1.00x (?)
LazilyFilteredArrays 64854 65223 +0.6% 0.99x (?)
LazilyFilteredRange 3882 3886 +0.1% 1.00x
LessSubstringSubstring 51 50 -2.0% 1.02x (?)
LessSubstringSubstringGenericComparable 49 50 +2.0% 0.98x
LinkedList 7526 7529 +0.0% 1.00x
LuhnAlgoEager 320 317 -0.9% 1.01x
LuhnAlgoLazy 318 323 +1.6% 0.98x
MapReduce 372 370 -0.5% 1.01x
MapReduceAnyCollection 429 434 +1.2% 0.99x (?)
MapReduceAnyCollectionShort 2259 2257 -0.1% 1.00x (?)
MapReduceClass 3029 3037 +0.3% 1.00x
MapReduceClassShort 4581 4575 -0.1% 1.00x
MapReduceLazyCollection 13 13 +0.0% 1.00x
MapReduceLazyCollectionShort 37 36 -2.7% 1.03x (?)
MapReduceLazySequence 86 86 +0.0% 1.00x
MapReduceSequence 461 461 +0.0% 1.00x
MapReduceShort 2001 1998 -0.1% 1.00x
MapReduceShortString 23 23 +0.0% 1.00x
MapReduceString 80 80 +0.0% 1.00x
Memset 216 219 +1.4% 0.99x (?)
MonteCarloE 10391 10392 +0.0% 1.00x (?)
MonteCarloPi 42847 42840 -0.0% 1.00x (?)
NSDictionaryCastToSwift 6810 6831 +0.3% 1.00x (?)
NSError 174 174 +0.0% 1.00x
NSStringConversion 687 698 +1.6% 0.98x
NibbleSort 3673 3673 +0.0% 1.00x
NopDeinit 32288 32275 -0.0% 1.00x (?)
ObjectAllocation 132 133 +0.8% 0.99x
ObjectiveCBridgeFromNSArrayAnyObject 25579 25074 -2.0% 1.02x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 45963 46840 +1.9% 0.98x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 44464 45317 +1.9% 0.98x (?)
ObjectiveCBridgeFromNSDictionaryAnyObject 109236 112594 +3.1% 0.97x
ObjectiveCBridgeFromNSSetAnyObject 49706 49365 -0.7% 1.01x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 5091 4898 -3.8% 1.04x (?)
ObjectiveCBridgeFromNSSetAnyObjectToString 66641 65440 -1.8% 1.02x (?)
ObjectiveCBridgeFromNSString 1187 1187 +0.0% 1.00x
ObjectiveCBridgeFromNSStringForced 2684 2674 -0.4% 1.00x (?)
ObjectiveCBridgeStubDataAppend 11268 11208 -0.5% 1.01x (?)
ObjectiveCBridgeStubDateMutation 400 400 +0.0% 1.00x
ObjectiveCBridgeStubFromNSDate 7286 7267 -0.3% 1.00x (?)
ObjectiveCBridgeStubFromNSString 1014 1016 +0.2% 1.00x (?)
ObjectiveCBridgeStubFromNSStringRef 170 170 +0.0% 1.00x
ObjectiveCBridgeStubNSDataAppend 2567 2564 -0.1% 1.00x (?)
ObjectiveCBridgeStubNSDateMutationRef 13213 13519 +2.3% 0.98x (?)
ObjectiveCBridgeStubToArrayOfNSString 38700 39735 +2.7% 0.97x (?)
ObjectiveCBridgeStubToNSDate 15723 15624 -0.6% 1.01x (?)
ObjectiveCBridgeStubToNSDateRef 3442 3427 -0.4% 1.00x (?)
ObjectiveCBridgeStubToNSString 2445 2392 -2.2% 1.02x
ObjectiveCBridgeStubToNSStringRef 121 121 +0.0% 1.00x
ObjectiveCBridgeStubURLAppendPath 290407 287966 -0.8% 1.01x (?)
ObjectiveCBridgeToNSArray 14600 14607 +0.0% 1.00x (?)
ObjectiveCBridgeToNSDictionary 27344 27239 -0.4% 1.00x (?)
ObjectiveCBridgeToNSSet 17190 17873 +4.0% 0.96x (?)
ObjectiveCBridgeToNSString 504 493 -2.2% 1.02x
ObserverClosure 2176 2164 -0.6% 1.01x (?)
ObserverForwarderStruct 1216 1242 +2.1% 0.98x (?)
ObserverPartiallyAppliedMethod 3766 3770 +0.1% 1.00x (?)
ObserverUnappliedMethod 2470 2468 -0.1% 1.00x (?)
OpenClose 336 336 +0.0% 1.00x
PartialApplyDynamicType 0 0 +0.0% 1.00x
Phonebook 4708 4666 -0.9% 1.01x
PointerArithmetics 34374 34372 -0.0% 1.00x (?)
PolymorphicCalls 25 25 +0.0% 1.00x
PopFrontArray 1994 2004 +0.5% 1.00x (?)
PopFrontArrayGeneric 2011 1973 -1.9% 1.02x (?)
PopFrontUnsafePointer 9673 9537 -1.4% 1.01x (?)
PrefixAnyCollection 84 84 +0.0% 1.00x
PrefixAnyCollectionLazy 64061 62442 -2.5% 1.03x (?)
PrefixAnySeqCRangeIter 16880 16773 -0.6% 1.01x
PrefixAnySeqCRangeIterLazy 16881 16756 -0.7% 1.01x
PrefixAnySeqCntRange 28 28 +0.0% 1.00x
PrefixAnySeqCntRangeLazy 28 28 +0.0% 1.00x
PrefixAnySequence 4322 4313 -0.2% 1.00x (?)
PrefixAnySequenceLazy 4317 4317 +0.0% 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 2225 2223 -0.1% 1.00x
PrefixSequenceLazy 2277 2276 -0.0% 1.00x (?)
PrefixWhileAnyCollection 154 154 +0.0% 1.00x
PrefixWhileAnyCollectionLazy 90 90 +0.0% 1.00x
PrefixWhileAnySeqCRangeIter 8715 8727 +0.1% 1.00x (?)
PrefixWhileAnySeqCRangeIterLazy 72 72 +0.0% 1.00x
PrefixWhileAnySeqCntRange 60 60 +0.0% 1.00x
PrefixWhileAnySeqCntRangeLazy 90 90 +0.0% 1.00x
PrefixWhileAnySequence 9815 9819 +0.0% 1.00x (?)
PrefixWhileAnySequenceLazy 1394 1393 -0.1% 1.00x (?)
PrefixWhileArray 88 88 +0.0% 1.00x
PrefixWhileArrayLazy 70 70 +0.0% 1.00x
PrefixWhileCountableRange 36 36 +0.0% 1.00x
PrefixWhileCountableRangeLazy 35 35 +0.0% 1.00x
PrefixWhileSequence 360 361 +0.3% 1.00x (?)
PrefixWhileSequenceLazy 52 52 +0.0% 1.00x
Prims 895 901 +0.7% 0.99x (?)
PrimsSplit 902 904 +0.2% 1.00x (?)
QueueConcrete 1148 1147 -0.1% 1.00x
QueueGeneric 1148 1147 -0.1% 1.00x (?)
RC4 149 149 +0.0% 1.00x
RGBHistogram 3248 3280 +1.0% 0.99x (?)
RGBHistogramOfObjects 23728 23714 -0.1% 1.00x (?)
RandomDoubleDef 28044 28023 -0.1% 1.00x (?)
RandomDoubleLCG 4370 4441 +1.6% 0.98x
RandomIntegersDef 25938 25978 +0.2% 1.00x (?)
RandomIntegersLCG 2384 2381 -0.1% 1.00x (?)
RandomShuffleDef 833652 834417 +0.1% 1.00x
RandomShuffleLCG 155024 155112 +0.1% 1.00x (?)
RangeAssignment 342 343 +0.3% 1.00x (?)
RangeIterationSigned 171 171 +0.0% 1.00x
RangeReplaceableCollectionPlusDefault 1012 1012 +0.0% 1.00x
RecursiveOwnedParameter 115 115 +0.0% 1.00x
RemoveWhereFilterInts 46 46 +0.0% 1.00x
RemoveWhereFilterString 255 244 -4.3% 1.05x
RemoveWhereFilterStrings 436 437 +0.2% 1.00x (?)
RemoveWhereMoveInts 14 14 +0.0% 1.00x
RemoveWhereMoveStrings 710 708 -0.3% 1.00x (?)
RemoveWhereQuadraticInts 1296 1297 +0.1% 1.00x (?)
RemoveWhereQuadraticString 395 379 -4.1% 1.04x
RemoveWhereQuadraticStrings 2762 2766 +0.1% 1.00x
RemoveWhereSwapInts 19 19 +0.0% 1.00x
RemoveWhereSwapStrings 865 860 -0.6% 1.01x
ReversedArray 57 57 +0.0% 1.00x
ReversedBidirectional 17020 17062 +0.2% 1.00x (?)
ReversedDictionary 267 267 +0.0% 1.00x
RomanNumbers 86936 87070 +0.2% 1.00x
SequenceAlgosAnySequence 12168 11994 -1.4% 1.01x
SequenceAlgosArray 1578 1578 +0.0% 1.00x
SequenceAlgosContiguousArray 1577 1578 +0.1% 1.00x (?)
SequenceAlgosList 1350 1350 +0.0% 1.00x
SequenceAlgosRange 2578 2578 +0.0% 1.00x
SequenceAlgosUnfoldSequence 1102 1103 +0.1% 1.00x
SetExclusiveOr 5206 5174 -0.6% 1.01x (?)
SetExclusiveOr_OfObjects 11763 11791 +0.2% 1.00x (?)
SetIntersect 698 699 +0.1% 1.00x (?)
SetIntersect_OfObjects 1758 1757 -0.1% 1.00x (?)
SetIsSubsetOf 355 355 +0.0% 1.00x
SetIsSubsetOf_OfObjects 493 493 +0.0% 1.00x
SetUnion 4515 4462 -1.2% 1.01x (?)
SetUnion_OfObjects 10083 10177 +0.9% 0.99x
SevenBoom 888 888 +0.0% 1.00x
Sim2DArray 417 417 +0.0% 1.00x
SortLargeExistentials 6057 6053 -0.1% 1.00x (?)
SortLettersInPlace 1062 1065 +0.3% 1.00x
SortSortedStrings 1050 1043 -0.7% 1.01x
SortStrings 2031 2002 -1.4% 1.01x
SortStringsUnicode 2598 2593 -0.2% 1.00x
StackPromo 24888 24851 -0.1% 1.00x (?)
StaticArray 9 9 +0.0% 1.00x
StrComplexWalk 1784 1785 +0.1% 1.00x (?)
StrToInt 3233 3231 -0.1% 1.00x
StringAdder 851 858 +0.8% 0.99x
StringBuilder 763 772 +1.2% 0.99x
StringBuilderSmallReservingCapacity 784 796 +1.5% 0.98x
StringComparison_abnormal 827 794 -4.0% 1.04x
StringComparison_ascii 1296 1295 -0.1% 1.00x (?)
StringComparison_emoji 805 815 +1.2% 0.99x
StringComparison_fastPrenormal 838 830 -1.0% 1.01x
StringComparison_latin1 655 653 -0.3% 1.00x
StringComparison_longSharedPrefix 941 941 +0.0% 1.00x
StringComparison_nonBMPSlowestPrenormal 1578 1638 +3.8% 0.96x (?)
StringComparison_slowerPrenormal 1694 1721 +1.6% 0.98x
StringComparison_zalgo 125090 125854 +0.6% 0.99x (?)
StringEdits 171116 167275 -2.2% 1.02x
StringEnumRawValueInitialization 934 938 +0.4% 1.00x
StringEqualPointerComparison 286 286 +0.0% 1.00x
StringFromLongWholeSubstring 21 21 +0.0% 1.00x
StringFromLongWholeSubstringGeneric 22 22 +0.0% 1.00x
StringHasPrefixAscii 2290 2291 +0.0% 1.00x (?)
StringHasPrefixUnicode 103527 102624 -0.9% 1.01x (?)
StringHasSuffixAscii 2510 2498 -0.5% 1.00x
StringHasSuffixUnicode 102086 102868 +0.8% 0.99x (?)
StringInterpolation 9914 10068 +1.6% 0.98x
StringInterpolationManySmallSegments 20783 20775 -0.0% 1.00x (?)
StringInterpolationSmall 6036 6056 +0.3% 1.00x (?)
StringMatch 12650 12761 +0.9% 0.99x
StringRemoveDupes 520 521 +0.2% 1.00x (?)
StringUTF16Builder 2699 2680 -0.7% 1.01x (?)
StringUTF16SubstringBuilder 5918 5811 -1.8% 1.02x (?)
StringWalk 1446 1442 -0.3% 1.00x (?)
StringWithCString 43162 43102 -0.1% 1.00x (?)
StringWordBuilder 2439 2441 +0.1% 1.00x (?)
StringWordBuilderReservingCapacity 1911 1913 +0.1% 1.00x (?)
SubstringComparable 27 27 +0.0% 1.00x
SubstringEqualString 612 619 +1.1% 0.99x
SubstringEquatable 1411 1432 +1.5% 0.99x (?)
SubstringFromLongString 10 10 +0.0% 1.00x
SubstringFromLongStringGeneric 74 74 +0.0% 1.00x
SuffixAnyCollection 30 31 +3.3% 0.97x
SuffixAnyCollectionLazy 20756 20898 +0.7% 0.99x (?)
SuffixAnySeqCRangeIter 3742 3747 +0.1% 1.00x (?)
SuffixAnySeqCRangeIterLazy 3750 3750 +0.0% 1.00x
SuffixAnySeqCntRange 20 21 +5.0% 0.95x
SuffixAnySeqCntRangeLazy 21 21 +0.0% 1.00x
SuffixAnySequence 4907 4908 +0.0% 1.00x (?)
SuffixAnySequenceLazy 5007 5008 +0.0% 1.00x (?)
SuffixCountableRange 11 11 +0.0% 1.00x
SuffixCountableRangeLazy 11 11 +0.0% 1.00x
SuffixSequence 3584 3594 +0.3% 1.00x (?)
SuffixSequenceLazy 3587 3582 -0.1% 1.00x (?)
SumUsingReduce 102 102 +0.0% 1.00x
SumUsingReduceInto 97 97 +0.0% 1.00x
SuperChars 14860 14862 +0.0% 1.00x (?)
TwoSum 1509 1519 +0.7% 0.99x (?)
TypeFlood 0 0 +0.0% 1.00x
UTF8Decode 318 318 +0.0% 1.00x
Walsh 421 420 -0.2% 1.00x (?)
WordCountHistogramASCII 7869 7744 -1.6% 1.02x
WordCountHistogramUTF16 14665 14755 +0.6% 0.99x (?)
WordCountUniqueASCII 2151 2154 +0.1% 1.00x (?)
WordCountUniqueUTF16 7944 7926 -0.2% 1.00x (?)
WordSplitASCII 6564 6694 +2.0% 0.98x (?)
WordSplitUTF16 8434 8547 +1.3% 0.99x (?)
XorLoop 402 401 -0.2% 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment