Skip to content

[stdlib] Adding RangeReplaceable.filter returning Self #9741

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
May 18, 2017

Conversation

moiseev
Copy link
Contributor

@moiseev moiseev commented May 18, 2017

This overload allows String.filter to return a String, and not
[Character].

In the other hand, introduction of this overload makes [123].filter
somewhat ambiguous in a sence, that the compiler will now prefer an
implementatin from a more concrete protocol, which is less efficient for
arrays, therefore extra work is needed to make sure Array types fallback
to the Sequence.filter.

Implements: rdar://problem/32209927

This overload allows `String.filter` to return a `String`, and not
`[Character]`.

In the other hand, introduction of this overload makes `[123].filter`
somewhat ambiguous in a sence, that the compiler will now prefer an
implementatin from a more concrete protocol, which is less efficient for
arrays, therefore extra work is needed to make sure Array types fallback
to the `Sequence.filter`.

Implements: <rdar://problem/32209927>
@moiseev moiseev requested a review from airspeedswift May 18, 2017 19:38
@moiseev
Copy link
Contributor Author

moiseev commented May 18, 2017

@swift-ci Please test

@moiseev
Copy link
Contributor Author

moiseev commented May 18, 2017

@swift-ci Please smoke benchmark

@moiseev
Copy link
Contributor Author

moiseev commented May 18, 2017

@swift-ci Please Test Source Compatibility

public func filter(
_ isIncluded: (Element) throws -> Bool
) rethrows -> Self {
return try Self(self.lazy.filter(isIncluded))
Copy link
Member

Choose a reason for hiding this comment

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

Probably worth checking that this is just as fast as a hand-rolled loop with append. It ought to be, and this is definitely the right way to code it, but worth checking. I'll add a benchmark – doesn't need to hold this up though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One cannot regress something that does not exist. 🤷‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the snippet I played with:

@inline(never)
public func iteration<
  C : RangeReplaceableCollection
>(_ xs: C, _ f: (C.Element) -> Bool) -> C {
    var result = C()
    var iterator = xs.makeIterator()
    while let element = iterator.next() {
      if f(element) {
        result.append(element)
      }
    }
    return result
}

@inline(never)
public func lazyFilter<
  C : RangeReplaceableCollection
>(_ xs: C, _ f: (C.Element) -> Bool) -> C {
  return C(xs.lazy.filter(f))
}


for _ in 0..<1_000 {
  /*_ = iteration(Array(0..<10000)) { $0 % 2 == 0 }*/
  _ = lazyFilter(Array(0..<10000)) { $0 % 2 == 0 }
}

Commenting one and uncommenting the other gives these results on my machine:

# lazyFilter                                                                                                                        
swiftc -swift-version 3 -O ../filter.swift -o ../filter && time ../filter
../filter  0.59s user 0.00s system 99% cpu 0.604 total

# iteration
swiftc -swift-version 3 -O ../filter.swift -o ../filter && time ../filter
../filter  1.45s user 0.00s system 99% cpu 1.462 total

#lazyFilter                                                                                                    
swiftc -swift-version 4 -O ../filter.swift -o ../filter && time ../filter
../filter  0.60s user 0.00s system 99% cpu 0.604 total

# iteration                                                                                                                        
swiftc -swift-version 4 -O ../filter.swift -o ../filter && time ../filter
../filter  1.46s user 0.00s system 99% cpu 1.469 total

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also both IR and SIL look better in case of lazyFilter.

@@ -877,6 +877,13 @@ extension Sequence {
public func filter(
_ isIncluded: (Element) throws -> Bool
) rethrows -> [Element] {
return try _filter(isIncluded)
Copy link
Member

Choose a reason for hiding this comment

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

This will mean ContiguousArray and ArraySlice will also return an Array from filter, not Self? Which is... probably the right thing? Worth checking my thinking though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what they have been doing all along. filter is not redefined anywhere near array types. They all inherit the default Sequence implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I see what you mean here... The line you commented on is misleading, but yeah, even with the addition of a new overload, they will still return [T].

Copy link
Member

Choose a reason for hiding this comment

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

Right. I was just questioning whether this is the right thing. I think it is for those two types specifically.

@swift-ci
Copy link
Contributor

Build comment file:

Optimized (O)

Regression (1)
TEST OLD NEW DELTA SPEEDUP
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 5180 5684 +9.7% 0.91x
Improvement (1)
TEST OLD NEW DELTA SPEEDUP
IterateData 759 706 -7.0% 1.08x
No Changes (270)
TEST OLD NEW DELTA SPEEDUP
AngryPhonebook 2948 2945 -0.1% 1.00x (?)
AnyHashableWithAClass 67025 67149 +0.2% 1.00x (?)
Array2D 2018 2011 -0.3% 1.00x (?)
ArrayAppend 772 773 +0.1% 1.00x (?)
ArrayAppendArrayOfInt 597 597 +0.0% 1.00x
ArrayAppendAscii 22257 22252 -0.0% 1.00x (?)
ArrayAppendFromGeneric 598 597 -0.2% 1.00x
ArrayAppendGenericStructs 1220 1217 -0.2% 1.00x (?)
ArrayAppendLatin1 43147 43260 +0.3% 1.00x (?)
ArrayAppendLazyMap 935 958 +2.5% 0.98x (?)
ArrayAppendOptionals 1225 1230 +0.4% 1.00x (?)
ArrayAppendRepeatCol 839 838 -0.1% 1.00x (?)
ArrayAppendReserved 534 534 +0.0% 1.00x
ArrayAppendSequence 945 945 +0.0% 1.00x
ArrayAppendStrings 13572 13570 -0.0% 1.00x (?)
ArrayAppendToFromGeneric 597 597 +0.0% 1.00x
ArrayAppendToGeneric 598 597 -0.2% 1.00x
ArrayAppendUTF16 40843 40786 -0.1% 1.00x (?)
ArrayInClass 61 61 +0.0% 1.00x
ArrayLiteral 1227 1222 -0.4% 1.00x (?)
ArrayOfGenericPOD 219 219 +0.0% 1.00x
ArrayOfGenericRef 3986 3997 +0.3% 1.00x (?)
ArrayOfPOD 166 166 +0.0% 1.00x
ArrayOfRef 3915 3889 -0.7% 1.01x
ArrayPlusEqualArrayOfInt 597 597 +0.0% 1.00x
ArrayPlusEqualFiveElementCollection 4826 4689 -2.8% 1.03x
ArrayPlusEqualSingleElementCollection 772 772 +0.0% 1.00x
ArrayPlusEqualThreeElements 1620 1614 -0.4% 1.00x
ArraySubscript 1508 1472 -2.4% 1.02x
ArrayValueProp 6 6 +0.0% 1.00x
ArrayValueProp2 6 6 +0.0% 1.00x
ArrayValueProp3 6 6 +0.0% 1.00x
ArrayValueProp4 6 6 +0.0% 1.00x
BitCount 13 13 +0.0% 1.00x
ByteSwap 0 0 +0.0% 1.00x
CStringLongAscii 5283 5283 +0.0% 1.00x
CStringLongNonAscii 2353 2351 -0.1% 1.00x (?)
CStringShortAscii 5695 5690 -0.1% 1.00x (?)
Calculator 33 33 +0.0% 1.00x
CaptureProp 4510 4516 +0.1% 1.00x (?)
CharacterLiteralsLarge 9055 8941 -1.3% 1.01x (?)
CharacterLiteralsSmall 311 312 +0.3% 1.00x (?)
Chars 1939 1939 +0.0% 1.00x
ClassArrayGetter 13 13 +0.0% 1.00x
DeadArray 184 185 +0.5% 0.99x (?)
Dictionary 567 565 -0.4% 1.00x
Dictionary2 1807 1811 +0.2% 1.00x
Dictionary2OfObjects 3319 3328 +0.3% 1.00x (?)
Dictionary3 465 467 +0.4% 1.00x (?)
Dictionary3OfObjects 898 905 +0.8% 0.99x
DictionaryBridge 2653 2628 -0.9% 1.01x (?)
DictionaryLiteral 1480 1476 -0.3% 1.00x
DictionaryOfObjects 2340 2341 +0.0% 1.00x (?)
DictionaryRemove 3314 3303 -0.3% 1.00x
DictionaryRemoveOfObjects 23466 23438 -0.1% 1.00x (?)
DictionarySwap 376 376 +0.0% 1.00x
DictionarySwapOfObjects 6895 6980 +1.2% 0.99x (?)
DropFirstAnyCollection 57 56 -1.8% 1.02x
DropFirstAnyCollectionLazy 44933 44876 -0.1% 1.00x
DropFirstAnySeqCRangeIter 27875 27913 +0.1% 1.00x
DropFirstAnySeqCRangeIterLazy 27881 27914 +0.1% 1.00x
DropFirstAnySeqCntRange 50 50 +0.0% 1.00x
DropFirstAnySeqCntRangeLazy 50 50 +0.0% 1.00x
DropFirstAnySequence 6994 7018 +0.3% 1.00x
DropFirstAnySequenceLazy 7021 7010 -0.2% 1.00x (?)
DropFirstArray 25 25 +0.0% 1.00x
DropFirstArrayLazy 25 25 +0.0% 1.00x
DropFirstCountableRange 32 32 +0.0% 1.00x
DropFirstCountableRangeLazy 32 32 +0.0% 1.00x
DropFirstSequence 3066 3065 -0.0% 1.00x
DropFirstSequenceLazy 3029 3029 +0.0% 1.00x
DropLastAnyCollection 22 22 +0.0% 1.00x
DropLastAnyCollectionLazy 14984 14986 +0.0% 1.00x (?)
DropLastAnySeqCRangeIter 4605 4609 +0.1% 1.00x
DropLastAnySeqCRangeIterLazy 4606 4611 +0.1% 1.00x
DropLastAnySeqCntRange 16 16 +0.0% 1.00x
DropLastAnySeqCntRangeLazy 16 16 +0.0% 1.00x
DropLastAnySequence 6795 6776 -0.3% 1.00x (?)
DropLastAnySequenceLazy 6547 6547 +0.0% 1.00x
DropLastArray 8 8 +0.0% 1.00x
DropLastArrayLazy 8 8 +0.0% 1.00x
DropLastCountableRange 10 10 +0.0% 1.00x
DropLastCountableRangeLazy 10 10 +0.0% 1.00x
DropLastSequence 599 601 +0.3% 1.00x
DropLastSequenceLazy 599 598 -0.2% 1.00x (?)
DropWhileAnyCollection 69 69 +0.0% 1.00x
DropWhileAnyCollectionLazy 103 103 +0.0% 1.00x
DropWhileAnySeqCRangeIter 22412 22300 -0.5% 1.01x
DropWhileAnySeqCRangeIterLazy 103 103 +0.0% 1.00x
DropWhileAnySeqCntRange 64 64 +0.0% 1.00x
DropWhileAnySeqCntRangeLazy 103 103 +0.0% 1.00x
DropWhileAnySequence 7601 7530 -0.9% 1.01x
DropWhileAnySequenceLazy 2032 2032 +0.0% 1.00x
DropWhileArray 37 37 +0.0% 1.00x
DropWhileArrayLazy 78 78 +0.0% 1.00x
DropWhileCountableRange 36 35 -2.8% 1.03x
DropWhileCountableRangeLazy 68 68 +0.0% 1.00x
DropWhileSequence 3123 3123 +0.0% 1.00x
DropWhileSequenceLazy 65 65 +0.0% 1.00x
ErrorHandling 2937 2939 +0.1% 1.00x (?)
GlobalClass 0 0 +0.0% 1.00x
Hanoi 3432 3433 +0.0% 1.00x (?)
HashTest 1762 1757 -0.3% 1.00x (?)
Histogram 246 246 +0.0% 1.00x
Integrate 262 262 +0.0% 1.00x
Join 450 453 +0.7% 0.99x (?)
LazilyFilteredArrays 64857 64840 -0.0% 1.00x (?)
LazilyFilteredRange 3893 3897 +0.1% 1.00x (?)
LinkedList 7044 7044 +0.0% 1.00x
MapReduce 330 331 +0.3% 1.00x (?)
MapReduceAnyCollection 308 306 -0.6% 1.01x (?)
MapReduceAnyCollectionShort 1998 2005 +0.4% 1.00x (?)
MapReduceClass 3078 3083 +0.2% 1.00x (?)
MapReduceClassShort 4515 4533 +0.4% 1.00x (?)
MapReduceLazyCollection 15 15 +0.0% 1.00x
MapReduceLazyCollectionShort 44 44 +0.0% 1.00x
MapReduceLazySequence 90 90 +0.0% 1.00x
MapReduceSequence 451 458 +1.6% 0.98x (?)
MapReduceShort 1914 1915 +0.1% 1.00x (?)
MapReduceShortString 21 21 +0.0% 1.00x
MapReduceString 109 109 +0.0% 1.00x
Memset 235 234 -0.4% 1.00x
MonteCarloE 10264 10260 -0.0% 1.00x (?)
MonteCarloPi 44071 44080 +0.0% 1.00x (?)
NSDictionaryCastToSwift 5375 5305 -1.3% 1.01x (?)
NSError 289 289 +0.0% 1.00x
NSStringConversion 787 787 +0.0% 1.00x
NopDeinit 28962 28956 -0.0% 1.00x (?)
ObjectAllocation 179 179 +0.0% 1.00x
ObjectiveCBridgeFromNSArrayAnyObject 24602 24727 +0.5% 0.99x (?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 4515 4614 +2.2% 0.98x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 44553 44098 -1.0% 1.01x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 37676 39628 +5.2% 0.95x (?)
ObjectiveCBridgeFromNSDictionaryAnyObject 118749 120579 +1.5% 0.98x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 94865 98310 +3.6% 0.96x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 91448 90938 -0.6% 1.01x (?)
ObjectiveCBridgeFromNSSetAnyObject 64097 64635 +0.8% 0.99x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 4116 4149 +0.8% 0.99x (?)
ObjectiveCBridgeFromNSSetAnyObjectToString 72701 72111 -0.8% 1.01x (?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 63242 62765 -0.8% 1.01x (?)
ObjectiveCBridgeFromNSString 1412 1442 +2.1% 0.98x (?)
ObjectiveCBridgeFromNSStringForced 2350 2334 -0.7% 1.01x
ObjectiveCBridgeStubDataAppend 3885 3739 -3.8% 1.04x
ObjectiveCBridgeStubDateAccess 181 181 +0.0% 1.00x
ObjectiveCBridgeStubDateMutation 272 272 +0.0% 1.00x
ObjectiveCBridgeStubFromArrayOfNSString 31322 31221 -0.3% 1.00x (?)
ObjectiveCBridgeStubFromNSDate 3702 3823 +3.3% 0.97x (?)
ObjectiveCBridgeStubFromNSDateRef 3672 3672 +0.0% 1.00x
ObjectiveCBridgeStubFromNSString 942 945 +0.3% 1.00x (?)
ObjectiveCBridgeStubFromNSStringRef 177 177 +0.0% 1.00x
ObjectiveCBridgeStubNSDataAppend 2313 2289 -1.0% 1.01x (?)
ObjectiveCBridgeStubNSDateMutationRef 12617 12820 +1.6% 0.98x (?)
ObjectiveCBridgeStubNSDateRefAccess 348 348 +0.0% 1.00x
ObjectiveCBridgeStubToArrayOfNSString 29135 28461 -2.3% 1.02x (?)
ObjectiveCBridgeStubToNSDate 14553 14987 +3.0% 0.97x (?)
ObjectiveCBridgeStubToNSDateRef 3389 3391 +0.1% 1.00x (?)
ObjectiveCBridgeStubToNSString 1514 1516 +0.1% 1.00x (?)
ObjectiveCBridgeStubToNSStringRef 108 108 +0.0% 1.00x
ObjectiveCBridgeStubURLAppendPath 223492 218391 -2.3% 1.02x (?)
ObjectiveCBridgeStubURLAppendPathRef 225355 220706 -2.1% 1.02x
ObjectiveCBridgeToNSArray 29195 29061 -0.5% 1.00x (?)
ObjectiveCBridgeToNSDictionary 45148 45434 +0.6% 0.99x (?)
ObjectiveCBridgeToNSSet 39672 40372 +1.8% 0.98x
ObjectiveCBridgeToNSString 1278 1274 -0.3% 1.00x (?)
ObserverClosure 2292 2286 -0.3% 1.00x (?)
ObserverForwarderStruct 1139 1134 -0.4% 1.00x (?)
ObserverPartiallyAppliedMethod 3802 3809 +0.2% 1.00x (?)
ObserverUnappliedMethod 2693 2690 -0.1% 1.00x (?)
OpenClose 55 55 +0.0% 1.00x
Phonebook 8085 8075 -0.1% 1.00x (?)
PolymorphicCalls 21 21 +0.0% 1.00x
PopFrontArray 1096 1097 +0.1% 1.00x (?)
PopFrontArrayGeneric 1099 1098 -0.1% 1.00x (?)
PopFrontUnsafePointer 8974 8973 -0.0% 1.00x (?)
PrefixAnyCollection 57 56 -1.8% 1.02x
PrefixAnyCollectionLazy 45000 45005 +0.0% 1.00x (?)
PrefixAnySeqCRangeIter 21914 21736 -0.8% 1.01x
PrefixAnySeqCRangeIterLazy 21898 21734 -0.7% 1.01x
PrefixAnySeqCntRange 51 51 +0.0% 1.00x
PrefixAnySeqCntRangeLazy 51 51 +0.0% 1.00x
PrefixAnySequence 6263 6257 -0.1% 1.00x (?)
PrefixAnySequenceLazy 6248 6246 -0.0% 1.00x (?)
PrefixArray 24 24 +0.0% 1.00x
PrefixArrayLazy 24 24 +0.0% 1.00x
PrefixCountableRange 32 32 +0.0% 1.00x
PrefixCountableRangeLazy 32 32 +0.0% 1.00x
PrefixSequence 2526 2526 +0.0% 1.00x
PrefixSequenceLazy 2617 2617 +0.0% 1.00x
PrefixWhileAnyCollection 96 96 +0.0% 1.00x
PrefixWhileAnyCollectionLazy 75 75 +0.0% 1.00x
PrefixWhileAnySeqCRangeIter 12520 12518 -0.0% 1.00x (?)
PrefixWhileAnySeqCRangeIterLazy 75 75 +0.0% 1.00x
PrefixWhileAnySeqCntRange 90 90 +0.0% 1.00x
PrefixWhileAnySeqCntRangeLazy 75 75 +0.0% 1.00x
PrefixWhileAnySequence 14034 14027 -0.0% 1.00x (?)
PrefixWhileAnySequenceLazy 1492 1492 +0.0% 1.00x
PrefixWhileArray 62 62 +0.0% 1.00x
PrefixWhileArrayLazy 49 49 +0.0% 1.00x
PrefixWhileCountableRange 36 36 +0.0% 1.00x
PrefixWhileCountableRangeLazy 32 32 +0.0% 1.00x
PrefixWhileSequence 313 312 -0.3% 1.00x
PrefixWhileSequenceLazy 28 28 +0.0% 1.00x
Prims 777 779 +0.3% 1.00x (?)
ProtocolDispatch 2728 2727 -0.0% 1.00x (?)
ProtocolDispatch2 167 168 +0.6% 0.99x (?)
RC4 159 159 +0.0% 1.00x
RGBHistogram 2313 2307 -0.3% 1.00x (?)
RGBHistogramOfObjects 24103 24101 -0.0% 1.00x (?)
RangeAssignment 299 298 -0.3% 1.00x (?)
RecursiveOwnedParameter 2313 2315 +0.1% 1.00x (?)
ReversedArray 49 49 +0.0% 1.00x
ReversedBidirectional 29020 29015 -0.0% 1.00x (?)
ReversedDictionary 109 108 -0.9% 1.01x
SetExclusiveOr 2979 2968 -0.4% 1.00x (?)
SetExclusiveOr_OfObjects 9619 9651 +0.3% 1.00x (?)
SetIntersect 275 274 -0.4% 1.00x (?)
SetIntersect_OfObjects 1727 1723 -0.2% 1.00x
SetIsSubsetOf 286 286 +0.0% 1.00x
SetIsSubsetOf_OfObjects 359 359 +0.0% 1.00x
SetUnion 2680 2645 -1.3% 1.01x (?)
SetUnion_OfObjects 8124 8051 -0.9% 1.01x (?)
SevenBoom 1469 1460 -0.6% 1.01x (?)
Sim2DArray 276 276 +0.0% 1.00x
SortLargeExistentials 7949 7951 +0.0% 1.00x (?)
SortLettersInPlace 1149 1148 -0.1% 1.00x (?)
SortSortedStrings 864 861 -0.3% 1.00x (?)
SortStrings 1648 1650 +0.1% 1.00x (?)
SortStringsUnicode 8074 7956 -1.5% 1.01x (?)
StackPromo 22337 22197 -0.6% 1.01x
StaticArray 21 21 +0.0% 1.00x
StrComplexWalk 720 722 +0.3% 1.00x
StrToInt 2369 2371 +0.1% 1.00x (?)
StringAdder 0 0 +0.0% 1.00x
StringBuilder 1375 1373 -0.1% 1.00x (?)
StringBuilderLong 947 964 +1.8% 0.98x
StringEdits 208779 209062 +0.1% 1.00x (?)
StringEqualPointerComparison 7329 7330 +0.0% 1.00x
StringFromLongWholeSubstring 15390 15399 +0.1% 1.00x (?)
StringFromLongWholeSubstringGeneric 218 218 +0.0% 1.00x
StringHasPrefix 33 33 +0.0% 1.00x
StringHasPrefixUnicode 14674 14784 +0.7% 0.99x
StringHasSuffix 33 33 +0.0% 1.00x
StringHasSuffixUnicode 61883 62164 +0.5% 1.00x
StringInterpolation 8610 8530 -0.9% 1.01x (?)
StringMatch 9343 9101 -2.6% 1.03x
StringUTF16Builder 2193 2176 -0.8% 1.01x
StringWalk 1270 1270 +0.0% 1.00x
StringWithCString 132280 132288 +0.0% 1.00x (?)
SubstringFromLongString 157 158 +0.6% 0.99x
SubstringFromLongStringGeneric 340 341 +0.3% 1.00x
SuffixAnyCollection 22 22 +0.0% 1.00x
SuffixAnyCollectionLazy 14982 14969 -0.1% 1.00x (?)
SuffixAnySeqCRangeIter 4929 4933 +0.1% 1.00x
SuffixAnySeqCRangeIterLazy 4929 4935 +0.1% 1.00x
SuffixAnySeqCntRange 16 16 +0.0% 1.00x
SuffixAnySeqCntRangeLazy 16 16 +0.0% 1.00x
SuffixAnySequence 6641 6645 +0.1% 1.00x (?)
SuffixAnySequenceLazy 6588 6622 +0.5% 0.99x (?)
SuffixArray 8 8 +0.0% 1.00x
SuffixArrayLazy 8 8 +0.0% 1.00x
SuffixCountableRange 10 10 +0.0% 1.00x
SuffixCountableRangeLazy 10 10 +0.0% 1.00x
SuffixSequence 4491 4493 +0.0% 1.00x
SuffixSequenceLazy 4491 4497 +0.1% 1.00x
SuperChars 103436 103103 -0.3% 1.00x (?)
TwoSum 865 859 -0.7% 1.01x
TypeFlood 0 0 +0.0% 1.00x
UTF8Decode 259 259 +0.0% 1.00x
Walsh 357 357 +0.0% 1.00x
XorLoop 347 347 +0.0% 1.00x
**Unoptimized (Onone)**
Regression (1)
TEST OLD NEW DELTA SPEEDUP
ObjectiveCBridgeStubFromArrayOfNSString 29433 31453 +6.9% 0.94x
Improvement (2)
TEST OLD NEW DELTA SPEEDUP
ObjectiveCBridgeStubDataAppend 4317 3823 -11.4% 1.13x
DropFirstArray 6792 6440 -5.2% 1.05x
No Changes (269)
TEST OLD NEW DELTA SPEEDUP
AngryPhonebook 3129 3137 +0.3% 1.00x (?)
AnyHashableWithAClass 84028 83489 -0.6% 1.01x
Array2D 609115 609214 +0.0% 1.00x (?)
ArrayAppend 4194 4193 -0.0% 1.00x (?)
ArrayAppendArrayOfInt 652 651 -0.2% 1.00x
ArrayAppendAscii 60490 60708 +0.4% 1.00x
ArrayAppendFromGeneric 655 655 +0.0% 1.00x
ArrayAppendGenericStructs 1312 1299 -1.0% 1.01x (?)
ArrayAppendLatin1 82193 82747 +0.7% 0.99x
ArrayAppendLazyMap 211114 210918 -0.1% 1.00x (?)
ArrayAppendOptionals 1324 1298 -2.0% 1.02x
ArrayAppendRepeatCol 213010 214435 +0.7% 0.99x
ArrayAppendReserved 3900 3900 +0.0% 1.00x
ArrayAppendSequence 76528 76281 -0.3% 1.00x
ArrayAppendStrings 13754 13712 -0.3% 1.00x (?)
ArrayAppendToFromGeneric 653 655 +0.3% 1.00x
ArrayAppendToGeneric 655 655 +0.0% 1.00x
ArrayAppendUTF16 79915 80995 +1.4% 0.99x
ArrayInClass 4734 4734 +0.0% 1.00x
ArrayLiteral 1482 1482 +0.0% 1.00x
ArrayOfGenericPOD 3075 3077 +0.1% 1.00x (?)
ArrayOfGenericRef 9583 9576 -0.1% 1.00x (?)
ArrayOfPOD 1832 1832 +0.0% 1.00x
ArrayOfRef 8737 8745 +0.1% 1.00x (?)
ArrayPlusEqualArrayOfInt 652 652 +0.0% 1.00x
ArrayPlusEqualFiveElementCollection 292158 291668 -0.2% 1.00x (?)
ArrayPlusEqualSingleElementCollection 285140 286069 +0.3% 1.00x (?)
ArrayPlusEqualThreeElements 10221 10105 -1.1% 1.01x (?)
ArraySubscript 4143 4138 -0.1% 1.00x (?)
ArrayValueProp 3028 3023 -0.2% 1.00x (?)
ArrayValueProp2 3665 3663 -0.1% 1.00x (?)
ArrayValueProp3 3442 3462 +0.6% 0.99x (?)
ArrayValueProp4 3343 3383 +1.2% 0.99x (?)
BitCount 178 178 +0.0% 1.00x
ByteSwap 26 26 +0.0% 1.00x
CStringLongAscii 5384 5361 -0.4% 1.00x (?)
CStringLongNonAscii 2435 2433 -0.1% 1.00x (?)
CStringShortAscii 8208 8181 -0.3% 1.00x (?)
Calculator 1123 1120 -0.3% 1.00x
CaptureProp 110560 108726 -1.7% 1.02x
CharacterLiteralsLarge 9876 9869 -0.1% 1.00x (?)
CharacterLiteralsSmall 1003 1002 -0.1% 1.00x
Chars 7283 7392 +1.5% 0.99x (?)
ClassArrayGetter 929 930 +0.1% 1.00x (?)
DeadArray 120901 118230 -2.2% 1.02x
Dictionary 1707 1696 -0.6% 1.01x
Dictionary2 3504 3494 -0.3% 1.00x (?)
Dictionary2OfObjects 5811 5825 +0.2% 1.00x (?)
Dictionary3 1346 1348 +0.1% 1.00x (?)
Dictionary3OfObjects 2244 2245 +0.0% 1.00x (?)
DictionaryBridge 2669 2750 +3.0% 0.97x (?)
DictionaryLiteral 8279 8240 -0.5% 1.00x (?)
DictionaryOfObjects 4568 4578 +0.2% 1.00x (?)
DictionaryRemove 21171 21209 +0.2% 1.00x
DictionaryRemoveOfObjects 55373 55886 +0.9% 0.99x
DictionarySwap 5538 5545 +0.1% 1.00x (?)
DictionarySwapOfObjects 19873 19868 -0.0% 1.00x (?)
DropFirstAnyCollection 19409 19250 -0.8% 1.01x
DropFirstAnyCollectionLazy 137484 137943 +0.3% 1.00x (?)
DropFirstAnySeqCRangeIter 30272 30109 -0.5% 1.01x
DropFirstAnySeqCRangeIterLazy 30150 29933 -0.7% 1.01x
DropFirstAnySeqCntRange 19496 19212 -1.5% 1.01x
DropFirstAnySeqCntRangeLazy 19483 19366 -0.6% 1.01x
DropFirstAnySequence 14458 14629 +1.2% 0.99x
DropFirstAnySequenceLazy 14328 14334 +0.0% 1.00x (?)
DropFirstArrayLazy 45882 46095 +0.5% 1.00x (?)
DropFirstCountableRange 339 339 +0.0% 1.00x
DropFirstCountableRangeLazy 38322 38539 +0.6% 0.99x (?)
DropFirstSequence 12840 12893 +0.4% 1.00x
DropFirstSequenceLazy 13626 13651 +0.2% 1.00x
DropLastAnyCollection 6494 6421 -1.1% 1.01x
DropLastAnyCollectionLazy 45483 45874 +0.9% 0.99x (?)
DropLastAnySeqCRangeIter 43406 43550 +0.3% 1.00x
DropLastAnySeqCRangeIterLazy 43487 43615 +0.3% 1.00x
DropLastAnySeqCntRange 6507 6409 -1.5% 1.02x (?)
DropLastAnySeqCntRangeLazy 6530 6488 -0.6% 1.01x
DropLastAnySequence 29118 29172 +0.2% 1.00x (?)
DropLastAnySequenceLazy 29059 29137 +0.3% 1.00x
DropLastArray 2171 2249 +3.6% 0.97x
DropLastArrayLazy 15577 15437 -0.9% 1.01x (?)
DropLastCountableRange 118 118 +0.0% 1.00x
DropLastCountableRangeLazy 12843 12930 +0.7% 0.99x
DropLastSequence 28664 28683 +0.1% 1.00x (?)
DropLastSequenceLazy 28625 29592 +3.4% 0.97x
DropWhileAnyCollection 25079 24964 -0.5% 1.00x
DropWhileAnyCollectionLazy 27158 26903 -0.9% 1.01x (?)
DropWhileAnySeqCRangeIter 32093 31733 -1.1% 1.01x
DropWhileAnySeqCRangeIterLazy 27463 27168 -1.1% 1.01x
DropWhileAnySeqCntRange 25037 25025 -0.0% 1.00x (?)
DropWhileAnySeqCntRangeLazy 27382 27081 -1.1% 1.01x
DropWhileAnySequence 16154 16080 -0.5% 1.00x
DropWhileAnySequenceLazy 12498 12507 +0.1% 1.00x
DropWhileArray 10027 10008 -0.2% 1.00x (?)
DropWhileArrayLazy 17669 17679 +0.1% 1.00x (?)
DropWhileCountableRange 6079 6054 -0.4% 1.00x
DropWhileCountableRangeLazy 26778 26571 -0.8% 1.01x
DropWhileSequence 15029 15093 +0.4% 1.00x
DropWhileSequenceLazy 11270 11309 +0.3% 1.00x (?)
ErrorHandling 3856 3835 -0.5% 1.01x (?)
GlobalClass 0 0 +0.0% 1.00x
Hanoi 17540 17446 -0.5% 1.01x
HashTest 14695 14619 -0.5% 1.01x
Histogram 8814 8741 -0.8% 1.01x (?)
Integrate 395 396 +0.3% 1.00x
IterateData 12833 12870 +0.3% 1.00x (?)
Join 1268 1270 +0.2% 1.00x (?)
LazilyFilteredArrays 1671274 1674393 +0.2% 1.00x (?)
LazilyFilteredRange 727748 718778 -1.2% 1.01x (?)
LinkedList 33303 33289 -0.0% 1.00x (?)
MapReduce 38649 38704 +0.1% 1.00x
MapReduceAnyCollection 37969 37932 -0.1% 1.00x
MapReduceAnyCollectionShort 50214 50544 +0.7% 0.99x (?)
MapReduceClass 44073 44010 -0.1% 1.00x (?)
MapReduceClassShort 54780 54765 -0.0% 1.00x (?)
MapReduceLazyCollection 32838 32788 -0.2% 1.00x
MapReduceLazyCollectionShort 43771 44147 +0.9% 0.99x (?)
MapReduceLazySequence 25257 25379 +0.5% 1.00x
MapReduceSequence 41561 41497 -0.2% 1.00x (?)
MapReduceShort 50003 50262 +0.5% 0.99x
MapReduceShortString 282 283 +0.4% 1.00x (?)
MapReduceString 2606 2596 -0.4% 1.00x (?)
Memset 43984 43985 +0.0% 1.00x (?)
MonteCarloE 135092 135491 +0.3% 1.00x
MonteCarloPi 52524 52521 -0.0% 1.00x (?)
NSDictionaryCastToSwift 6386 6363 -0.4% 1.00x (?)
NSError 704 717 +1.8% 0.98x (?)
NSStringConversion 1349 1371 +1.6% 0.98x
NopDeinit 54090 53972 -0.2% 1.00x (?)
ObjectAllocation 636 634 -0.3% 1.00x
ObjectiveCBridgeFromNSArrayAnyObject 25624 26027 +1.6% 0.98x
ObjectiveCBridgeFromNSArrayAnyObjectForced 7821 7819 -0.0% 1.00x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 45133 44825 -0.7% 1.01x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 38741 40527 +4.6% 0.96x
ObjectiveCBridgeFromNSDictionaryAnyObject 122953 123635 +0.6% 0.99x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 7852 7896 +0.6% 0.99x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 100843 105633 +4.7% 0.95x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 90998 94620 +4.0% 0.96x (?)
ObjectiveCBridgeFromNSSetAnyObject 67933 67629 -0.4% 1.00x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 7190 7052 -1.9% 1.02x (?)
ObjectiveCBridgeFromNSSetAnyObjectToString 76116 76111 -0.0% 1.00x (?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 66900 66981 +0.1% 1.00x (?)
ObjectiveCBridgeFromNSString 4013 4046 +0.8% 0.99x (?)
ObjectiveCBridgeFromNSStringForced 2747 2727 -0.7% 1.01x
ObjectiveCBridgeStubDateAccess 1023 1049 +2.5% 0.98x
ObjectiveCBridgeStubDateMutation 515 515 +0.0% 1.00x
ObjectiveCBridgeStubFromNSDate 4175 4303 +3.1% 0.97x
ObjectiveCBridgeStubFromNSDateRef 4060 4062 +0.0% 1.00x (?)
ObjectiveCBridgeStubFromNSString 978 990 +1.2% 0.99x (?)
ObjectiveCBridgeStubFromNSStringRef 208 208 +0.0% 1.00x
ObjectiveCBridgeStubNSDataAppend 2708 2766 +2.1% 0.98x (?)
ObjectiveCBridgeStubNSDateMutationRef 15677 15735 +0.4% 1.00x (?)
ObjectiveCBridgeStubNSDateRefAccess 1212 1214 +0.2% 1.00x (?)
ObjectiveCBridgeStubToArrayOfNSString 29150 29271 +0.4% 1.00x (?)
ObjectiveCBridgeStubToNSDate 14777 15412 +4.3% 0.96x (?)
ObjectiveCBridgeStubToNSDateRef 3382 3402 +0.6% 0.99x (?)
ObjectiveCBridgeStubToNSString 1568 1568 +0.0% 1.00x
ObjectiveCBridgeStubToNSStringRef 149 149 +0.0% 1.00x
ObjectiveCBridgeStubURLAppendPath 224382 220267 -1.8% 1.02x (?)
ObjectiveCBridgeStubURLAppendPathRef 222700 221865 -0.4% 1.00x (?)
ObjectiveCBridgeToNSArray 29602 29647 +0.2% 1.00x (?)
ObjectiveCBridgeToNSDictionary 45595 46209 +1.3% 0.99x (?)
ObjectiveCBridgeToNSSet 40000 40286 +0.7% 0.99x (?)
ObjectiveCBridgeToNSString 1312 1312 +0.0% 1.00x
ObserverClosure 6627 6617 -0.2% 1.00x (?)
ObserverForwarderStruct 4697 4699 +0.0% 1.00x (?)
ObserverPartiallyAppliedMethod 8066 8061 -0.1% 1.00x (?)
ObserverUnappliedMethod 8456 8423 -0.4% 1.00x (?)
OpenClose 448 449 +0.2% 1.00x
Phonebook 24285 24055 -0.9% 1.01x
PolymorphicCalls 2925 2891 -1.2% 1.01x
PopFrontArray 7512 7450 -0.8% 1.01x (?)
PopFrontArrayGeneric 6570 6504 -1.0% 1.01x
PopFrontUnsafePointer 97420 97603 +0.2% 1.00x (?)
PrefixAnyCollection 19495 19350 -0.7% 1.01x
PrefixAnyCollectionLazy 137241 136096 -0.8% 1.01x (?)
PrefixAnySeqCRangeIter 24351 24242 -0.4% 1.00x
PrefixAnySeqCRangeIterLazy 24315 24230 -0.3% 1.00x (?)
PrefixAnySeqCntRange 19394 19224 -0.9% 1.01x (?)
PrefixAnySeqCntRangeLazy 19375 19330 -0.2% 1.00x (?)
PrefixAnySequence 11761 11818 +0.5% 1.00x (?)
PrefixAnySequenceLazy 12236 12224 -0.1% 1.00x (?)
PrefixArray 6398 6655 +4.0% 0.96x
PrefixArrayLazy 45966 46100 +0.3% 1.00x (?)
PrefixCountableRange 340 340 +0.0% 1.00x
PrefixCountableRangeLazy 38255 38562 +0.8% 0.99x
PrefixSequence 10688 10694 +0.1% 1.00x
PrefixSequenceLazy 11131 11277 +1.3% 0.99x
PrefixWhileAnyCollection 36438 36281 -0.4% 1.00x
PrefixWhileAnyCollectionLazy 23433 23123 -1.3% 1.01x
PrefixWhileAnySeqCRangeIter 41855 41810 -0.1% 1.00x (?)
PrefixWhileAnySeqCRangeIterLazy 22882 23091 +0.9% 0.99x (?)
PrefixWhileAnySeqCntRange 36397 36204 -0.5% 1.01x (?)
PrefixWhileAnySeqCntRangeLazy 22964 23344 +1.7% 0.98x (?)
PrefixWhileAnySequence 29818 29748 -0.2% 1.00x (?)
PrefixWhileAnySequenceLazy 12005 12213 +1.7% 0.98x (?)
PrefixWhileArray 17139 17014 -0.7% 1.01x (?)
PrefixWhileArrayLazy 15535 16220 +4.4% 0.96x
PrefixWhileCountableRange 17438 17371 -0.4% 1.00x
PrefixWhileCountableRangeLazy 22063 22042 -0.1% 1.00x (?)
PrefixWhileSequence 28492 28539 +0.2% 1.00x (?)
PrefixWhileSequenceLazy 10350 10465 +1.1% 0.99x (?)
Prims 9065 9003 -0.7% 1.01x
ProtocolDispatch 6939 6938 -0.0% 1.00x (?)
ProtocolDispatch2 489 489 +0.0% 1.00x
RC4 19536 19461 -0.4% 1.00x
RGBHistogram 33943 33833 -0.3% 1.00x (?)
RGBHistogramOfObjects 99739 99321 -0.4% 1.00x (?)
RangeAssignment 5719 5729 +0.2% 1.00x (?)
RecursiveOwnedParameter 9635 9634 -0.0% 1.00x (?)
ReversedArray 590 590 +0.0% 1.00x
ReversedBidirectional 74314 74337 +0.0% 1.00x (?)
ReversedDictionary 26688 26668 -0.1% 1.00x
SetExclusiveOr 21196 21140 -0.3% 1.00x (?)
SetExclusiveOr_OfObjects 41097 41225 +0.3% 1.00x
SetIntersect 10671 10675 +0.0% 1.00x (?)
SetIntersect_OfObjects 11222 11216 -0.1% 1.00x (?)
SetIsSubsetOf 1635 1641 +0.4% 1.00x
SetIsSubsetOf_OfObjects 1529 1531 +0.1% 1.00x (?)
SetUnion 12248 12249 +0.0% 1.00x (?)
SetUnion_OfObjects 29629 29728 +0.3% 1.00x (?)
SevenBoom 1612 1617 +0.3% 1.00x (?)
Sim2DArray 30065 30031 -0.1% 1.00x (?)
SortLargeExistentials 18018 17994 -0.1% 1.00x (?)
SortLettersInPlace 2852 2839 -0.5% 1.00x (?)
SortSortedStrings 1401 1403 +0.1% 1.00x
SortStrings 2487 2463 -1.0% 1.01x
SortStringsUnicode 9191 9006 -2.0% 1.02x
StackPromo 100048 101167 +1.1% 0.99x (?)
StaticArray 4579 4579 +0.0% 1.00x
StrComplexWalk 6850 6849 -0.0% 1.00x (?)
StrToInt 86465 86799 +0.4% 1.00x (?)
StringAdder 45 44 -2.2% 1.02x
StringBuilder 2871 2867 -0.1% 1.00x (?)
StringBuilderLong 1172 1172 +0.0% 1.00x
StringEdits 491289 490212 -0.2% 1.00x (?)
StringEqualPointerComparison 9529 9681 +1.6% 0.98x
StringFromLongWholeSubstring 15432 15460 +0.2% 1.00x
StringFromLongWholeSubstringGeneric 268 268 +0.0% 1.00x
StringHasPrefix 1727 1727 +0.0% 1.00x
StringHasPrefixUnicode 16162 16525 +2.2% 0.98x
StringHasSuffix 1919 1982 +3.3% 0.97x
StringHasSuffixUnicode 63918 64205 +0.4% 1.00x (?)
StringInterpolation 12310 12179 -1.1% 1.01x (?)
StringMatch 31437 31365 -0.2% 1.00x
StringUTF16Builder 3690 3662 -0.8% 1.01x (?)
StringWalk 4259 4258 -0.0% 1.00x (?)
StringWithCString 133633 133653 +0.0% 1.00x (?)
SubstringFromLongString 174 175 +0.6% 0.99x
SubstringFromLongStringGeneric 395 395 +0.0% 1.00x
SuffixAnyCollection 6487 6438 -0.8% 1.01x
SuffixAnyCollectionLazy 45267 46721 +3.2% 0.97x
SuffixAnySeqCRangeIter 41583 41414 -0.4% 1.00x
SuffixAnySeqCRangeIterLazy 41590 41501 -0.2% 1.00x
SuffixAnySeqCntRange 6486 6419 -1.0% 1.01x (?)
SuffixAnySeqCntRangeLazy 6537 6493 -0.7% 1.01x (?)
SuffixAnySequence 27031 26977 -0.2% 1.00x (?)
SuffixAnySequenceLazy 26904 26913 +0.0% 1.00x
SuffixArray 2276 2246 -1.3% 1.01x (?)
SuffixArrayLazy 15604 15298 -2.0% 1.02x
SuffixCountableRange 118 118 +0.0% 1.00x
SuffixCountableRangeLazy 12897 12935 +0.3% 1.00x (?)
SuffixSequence 26513 26549 +0.1% 1.00x (?)
SuffixSequenceLazy 27291 27298 +0.0% 1.00x (?)
SuperChars 114757 114657 -0.1% 1.00x (?)
TwoSum 4300 4296 -0.1% 1.00x (?)
TypeFlood 158 162 +2.5% 0.98x (?)
UTF8Decode 37019 37049 +0.1% 1.00x
Walsh 11955 11969 +0.1% 1.00x (?)
XorLoop 23706 23706 +0.0% 1.00x
**Hardware Overview** Model Name: Mac mini Model Identifier: Macmini7,1 Processor Name: Intel Core i5 Processor Speed: 2.8 GHz Number of Processors: 1 Total Number of Cores: 2 L2 Cache (per Core): 256 KB L3 Cache: 3 MB Memory: 16 GB

@airspeedswift
Copy link
Member

@swift-ci please smoke test linux platform

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