Skip to content

[stdlib] Give Sequence a top-level Element #8939

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

Closed

Conversation

airspeedswift
Copy link
Member

Adds an associatedtype Element to Sequence, then constrains Iterator.Element to match it.

@airspeedswift airspeedswift force-pushed the begone-iterator.element branch from 9312771 to 089f44e Compare April 22, 2017 21:08
@airspeedswift
Copy link
Member Author

OK I think the only ones left in the core stdlib are compiler crashers.

@airspeedswift
Copy link
Member Author

@swift-ci Please benchmark

// be used as IndexingIterator<T>'s Element. Here we arrange for
// the Collection itself to have an Element type that's deducible from
// its subscript. Ideally we'd like to constrain this Element to be the same
// as Collection.Iterator.Element (see below), but we have no way of
// as Collection.Element (see below), but we have no way of
// expressing it today.
associatedtype _Element
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we dump this now?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, seems we still need it, though I managed to ditch a handful of uses.

@dabrahams
Copy link
Contributor

dabrahams commented Apr 22, 2017 via email

@swift-ci
Copy link
Contributor

Build comment file:

Optimized (O)

Regression (6)
TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
OpenClose 48 54 +12.5% 0.89x
ObjectiveCBridgeStubNSDateRefAccess 318 344 +8.2% 0.92x
Calculator 43 46 +7.0% 0.93x
NopDeinit 27440 29448 +7.3% 0.93x
StrToInt 4393 4709 +7.2% 0.93x
ObserverUnappliedMethod 2650 2826 +6.6% 0.94x
Improvement (3)
TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
DropLastCountableRange 9 8 -11.1% 1.12x
DropWhileSequenceLazy 76 67 -11.8% 1.13x
BitCount 1 0 -99.9% 1001.00x
No Changes (259)
TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
HashQuadratic 6344402 6061263 -4.5% 1.05x
DropLastSequenceLazy 529 509 -3.8% 1.04x
DropLastSequence 530 509 -4.0% 1.04x
PrefixWhileSequence 441 424 -3.9% 1.04x
SuffixAnySequence 6932 6741 -2.8% 1.03x(?)
ObjectiveCBridgeToNSSet 36562 35610 -2.6% 1.03x(?)
SuffixAnySeqCRangeIter 5057 4926 -2.6% 1.03x
PrefixSequence 2637 2563 -2.8% 1.03x
DropLastAnySequence 6958 6782 -2.5% 1.03x
DropWhileCountableRange 36 35 -2.8% 1.03x
ObjectiveCBridgeStubFromNSDate 3670 3576 -2.6% 1.03x
DropFirstAnySeqCRangeIterLazy 27762 27305 -1.6% 1.02x(?)
PrefixAnySeqCRangeIter 21967 21522 -2.0% 1.02x
Hanoi 3476 3418 -1.7% 1.02x
PrefixAnySeqCRangeIterLazy 21981 21586 -1.8% 1.02x
CStringLongNonAscii 4141 4075 -1.6% 1.02x(?)
MapReduce 331 326 -1.5% 1.02x(?)
DropFirstAnySeqCRangeIter 27763 27305 -1.6% 1.02x(?)
StringHasPrefixUnicode 14717 14367 -2.4% 1.02x(?)
MonteCarloE 10420 10250 -1.6% 1.02x
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 72193 71126 -1.5% 1.02x(?)
RGBHistogram 2532 2494 -1.5% 1.02x(?)
DropWhileSequence 3128 3063 -2.1% 1.02x
DropFirstAnyCollection 128 126 -1.6% 1.02x(?)
PrefixWhileAnySeqCRangeIter 12679 12511 -1.3% 1.01x(?)
SortStrings 1725 1715 -0.6% 1.01x(?)
DictionaryBridge 2731 2700 -1.1% 1.01x(?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 4491 4465 -0.6% 1.01x(?)
MapReduceString 72 71 -1.4% 1.01x(?)
PrefixWhileAnySeqCntRange 155 154 -0.7% 1.01x
RangeAssignment 308 304 -1.3% 1.01x(?)
Integrate 269 267 -0.7% 1.01x(?)
ObjectiveCBridgeStubNSDateMutationRef 12357 12237 -1.0% 1.01x(?)
StringHasSuffixUnicode 62199 61357 -1.4% 1.01x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 105848 105252 -0.6% 1.01x(?)
CStringLongAscii 13808 13620 -1.4% 1.01x
HashTest 1752 1743 -0.5% 1.01x(?)
DropFirstAnySequenceLazy 6831 6755 -1.1% 1.01x
ObjectiveCBridgeStubToNSStringRef 109 108 -0.9% 1.01x
SuffixAnySequenceLazy 6608 6516 -1.4% 1.01x(?)
CStringShortAscii 6033 5994 -0.7% 1.01x(?)
ObjectiveCBridgeStubDataAppend 3682 3655 -0.7% 1.01x(?)
PopFrontArray 1074 1065 -0.8% 1.01x
DropWhileAnySequence 7565 7474 -1.2% 1.01x
ErrorHandling 2958 2937 -0.7% 1.01x(?)
PrefixAnySequenceLazy 6112 6080 -0.5% 1.01x(?)
ReversedBidirectional 48363 48090 -0.6% 1.01x(?)
SuffixSequenceLazy 4500 4471 -0.6% 1.01x
DropLastAnySequenceLazy 6609 6517 -1.4% 1.01x
SevenBoom 1481 1473 -0.5% 1.01x(?)
267 9978715 9838278 -1.4% 1.01x
SuffixSequence 4499 4472 -0.6% 1.01x(?)
SortSortedStrings 869 864 -0.6% 1.01x
SuffixAnySeqCRangeIterLazy 4999 4926 -1.5% 1.01x
SetExclusiveOr_OfObjects 9379 9409 +0.3% 1.00x(?)
ObjectiveCBridgeToNSString 1286 1290 +0.3% 1.00x(?)
StackPromo 21996 22025 +0.1% 1.00x(?)
ObjectiveCBridgeFromNSDictionaryAnyObject 133597 134006 +0.3% 1.00x(?)
DropFirstCountableRangeLazy 23 23 +0.0% 1.00x
RecursiveOwnedParameter 2357 2352 -0.2% 1.00x(?)
ObjectiveCBridgeStubToNSString 1524 1522 -0.1% 1.00x(?)
PrefixAnySequence 6098 6123 +0.4% 1.00x(?)
StringBuilderLong 955 951 -0.4% 1.00x(?)
PrefixSequenceLazy 2599 2600 +0.0% 1.00x(?)
ClassArrayGetter 13 13 +0.0% 1.00x
Array2D 2024 2027 +0.1% 1.00x(?)
Histogram 247 247 +0.0% 1.00x
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 5784 5810 +0.5% 1.00x(?)
ProtocolDispatch2 161 161 +0.0% 1.00x
DropLastAnySeqCRangeIterLazy 4605 4605 +0.0% 1.00x
PrefixWhileAnyCollection 160 160 +0.0% 1.00x
PrefixWhileCountableRangeLazy 23 23 +0.0% 1.00x
MonteCarloPi 44072 44058 -0.0% 1.00x(?)
StringWithCString 335364 335297 -0.0% 1.00x(?)
PrefixAnyCollectionLazy 44982 44989 +0.0% 1.00x(?)
Prims 774 773 -0.1% 1.00x(?)
DropFirstCountableRange 23 23 +0.0% 1.00x
SortLettersInPlace 1161 1164 +0.3% 1.00x(?)
DictionarySwap 369 369 +0.0% 1.00x
ReversedDictionary 108 108 +0.0% 1.00x
DropWhileAnySequenceLazy 2108 2108 +0.0% 1.00x
ArrayAppendToFromGeneric 596 596 +0.0% 1.00x
PrefixWhileAnySequenceLazy 1587 1586 -0.1% 1.00x(?)
Dictionary3OfObjects 1090 1088 -0.2% 1.00x(?)
StringUTF16Builder 2208 2211 +0.1% 1.00x(?)
DropFirstArray 29 29 +0.0% 1.00x
PrefixCountableRangeLazy 23 23 +0.0% 1.00x
PrefixAnySeqCntRangeLazy 115 115 +0.0% 1.00x
ByteSwap 0 0 +0.0% 1.00x
ArrayAppendGenericStructs 1221 1217 -0.3% 1.00x(?)
SuperChars 297964 297224 -0.2% 1.00x(?)
ArrayPlusEqualFiveElementCollection 5290 5279 -0.2% 1.00x(?)
ObjectiveCBridgeStubToNSDate 14570 14545 -0.2% 1.00x(?)
DropLastAnySeqCntRange 40 40 +0.0% 1.00x
DropFirstSequenceLazy 3031 3031 +0.0% 1.00x
DropWhileAnyCollectionLazy 87 87 +0.0% 1.00x
PrefixWhileAnyCollectionLazy 77 77 +0.0% 1.00x
DropLastAnySeqCntRangeLazy 40 40 +0.0% 1.00x
ObserverClosure 2288 2284 -0.2% 1.00x(?)
AnyHashableWithAClass 67518 67471 -0.1% 1.00x(?)
CharacterLiteralsSmall 778 778 +0.0% 1.00x
DropFirstAnySeqCntRangeLazy 115 115 +0.0% 1.00x
PrefixArray 29 29 +0.0% 1.00x
ArrayPlusEqualSingleElementCollection 772 773 +0.1% 1.00x(?)
ArrayAppendStrings 13522 13516 -0.0% 1.00x(?)
ObjectiveCBridgeStubFromNSStringRef 173 173 +0.0% 1.00x
StaticArray 154 154 +0.0% 1.00x
SuffixCountableRangeLazy 8 8 +0.0% 1.00x
ProtocolDispatch 2424 2424 +0.0% 1.00x
ObjectAllocation 179 179 +0.0% 1.00x
TypeFlood 0 0 +0.0% 1.00x
MapReduceAnyCollectionShort 1997 2002 +0.2% 1.00x(?)
DropLastAnyCollection 52 52 +0.0% 1.00x
ArrayLiteral 1224 1224 +0.0% 1.00x
Dictionary3 603 600 -0.5% 1.00x(?)
Dictionary2 2079 2076 -0.1% 1.00x(?)
SetIntersect_OfObjects 1737 1737 +0.0% 1.00x
Join 447 446 -0.2% 1.00x(?)
ArrayOfRef 3908 3897 -0.3% 1.00x(?)
StringHasPrefix 608 608 +0.0% 1.00x
DropLastArray 10 10 +0.0% 1.00x
ObjectiveCBridgeToNSArray 28660 28593 -0.2% 1.00x(?)
NSError 290 289 -0.3% 1.00x(?)
PrefixCountableRange 23 23 +0.0% 1.00x
DropLastAnyCollectionLazy 14954 14936 -0.1% 1.00x(?)
DictionaryOfObjects 2681 2687 +0.2% 1.00x(?)
ObjectiveCBridgeStubToNSDateRef 3374 3360 -0.4% 1.00x(?)
PopFrontArrayGeneric 1071 1066 -0.5% 1.00x(?)
DropFirstSequence 3066 3066 +0.0% 1.00x
PopFrontUnsafePointer 8877 8876 -0.0% 1.00x(?)
StringEqualPointerComparison 7313 7314 +0.0% 1.00x(?)
PrefixWhileAnySeqCRangeIterLazy 77 77 +0.0% 1.00x
DropWhileAnySeqCntRange 128 128 +0.0% 1.00x
ArrayAppendFromGeneric 596 596 +0.0% 1.00x
DropLastCountableRangeLazy 8 8 +0.0% 1.00x
PrefixWhileSequenceLazy 34 34 +0.0% 1.00x
ArrayAppendUTF16 39394 39448 +0.1% 1.00x(?)
StringInterpolation 8380 8350 -0.4% 1.00x(?)
IterateData 770 770 +0.0% 1.00x
DictionaryLiteral 1495 1490 -0.3% 1.00x(?)
PrefixWhileArray 66 66 +0.0% 1.00x
ArrayAppendReserved 532 532 +0.0% 1.00x
ArrayOfGenericPOD 219 219 +0.0% 1.00x
UTF8Decode 281 281 +0.0% 1.00x
MapReduceLazySequence 90 90 +0.0% 1.00x
LazilyFilteredArrays 71586 71707 +0.2% 1.00x(?)
SetIsSubsetOf 290 290 +0.0% 1.00x
Dictionary 832 831 -0.1% 1.00x(?)
ObjectiveCBridgeStubDateMutation 272 272 +0.0% 1.00x
DropLastAnySeqCRangeIter 4605 4603 -0.0% 1.00x(?)
SetIntersect 273 272 -0.4% 1.00x(?)
PrefixWhileArrayLazy 58 58 +0.0% 1.00x
ObjectiveCBridgeFromNSSetAnyObjectToString 80668 80843 +0.2% 1.00x(?)
StringBuilder 1394 1391 -0.2% 1.00x(?)
ArrayInClass 61 61 +0.0% 1.00x
ArrayOfGenericRef 4005 4017 +0.3% 1.00x(?)
Phonebook 7431 7416 -0.2% 1.00x(?)
PolymorphicCalls 22 22 +0.0% 1.00x
Sim2DArray 276 276 +0.0% 1.00x
SetExclusiveOr 2587 2589 +0.1% 1.00x(?)
ArrayAppendRepeatCol 836 837 +0.1% 1.00x(?)
MapReduceShortString 19 19 +0.0% 1.00x
ObjectiveCBridgeToNSDictionary 59402 59469 +0.1% 1.00x(?)
DropWhileArrayLazy 80 80 +0.0% 1.00x
StringEdits 266901 267800 +0.3% 1.00x(?)
DropWhileAnyCollection 133 133 +0.0% 1.00x
DropFirstArrayLazy 29 29 +0.0% 1.00x
SuffixArrayLazy 10 10 +0.0% 1.00x
RC4 156 156 +0.0% 1.00x
ArrayAppendToGeneric 596 596 +0.0% 1.00x
Walsh 352 351 -0.3% 1.00x(?)
SetIsSubsetOf_OfObjects 356 355 -0.3% 1.00x(?)
ArrayAppend 772 775 +0.4% 1.00x(?)
XorLoop 347 347 +0.0% 1.00x
SuffixAnySeqCntRangeLazy 40 40 +0.0% 1.00x
SuffixAnyCollectionLazy 15020 15041 +0.1% 1.00x(?)
LinkedList 7157 7164 +0.1% 1.00x(?)
ReversedArray 49 49 +0.0% 1.00x
StringAdder 0 0 +0.0% 1.00x
MapReduceAnyCollection 302 302 +0.0% 1.00x
ObjectiveCBridgeFromNSArrayAnyObject 23072 23075 +0.0% 1.00x(?)
DropLastArrayLazy 10 10 +0.0% 1.00x
RGBHistogramOfObjects 24701 24747 +0.2% 1.00x(?)
NSStringConversion 759 757 -0.3% 1.00x(?)
SuffixCountableRange 8 8 +0.0% 1.00x
MapReduceLazyCollection 15 15 +0.0% 1.00x
ObjectiveCBridgeFromNSSetAnyObjectForced 4918 4921 +0.1% 1.00x(?)
DropFirstAnyCollectionLazy 45012 45031 +0.0% 1.00x(?)
ArrayAppendArrayOfInt 596 596 +0.0% 1.00x
ArrayOfPOD 166 166 +0.0% 1.00x
DropFirstAnySeqCntRange 115 115 +0.0% 1.00x
Chars 1387 1386 -0.1% 1.00x(?)
DropWhileAnySeqCRangeIterLazy 87 87 +0.0% 1.00x
PrefixWhileAnySequence 14011 13995 -0.1% 1.00x
ArrayAppendSequence 994 995 +0.1% 1.00x(?)
ArrayValueProp2 6 6 +0.0% 1.00x
AngryPhonebook 2911 2901 -0.3% 1.00x(?)
ArrayPlusEqualArrayOfInt 595 596 +0.2% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 37592 37435 -0.4% 1.00x(?)
ArrayValueProp 6 6 +0.0% 1.00x
DropWhileArray 42 42 +0.0% 1.00x
SuffixArray 11 11 +0.0% 1.00x
DropFirstAnySequence 6808 6782 -0.4% 1.00x
MapReduceClass 2973 2974 +0.0% 1.00x(?)
PrefixWhileAnySeqCntRangeLazy 77 77 +0.0% 1.00x
ObjectiveCBridgeFromNSString 1405 1407 +0.1% 1.00x(?)
GlobalClass 0 0 +0.0% 1.00x
Memset 234 235 +0.4% 1.00x
Dictionary2OfObjects 3609 3609 +0.0% 1.00x
ArrayValueProp4 6 6 +0.0% 1.00x
TwoSum 868 871 +0.3% 1.00x(?)
ObjectiveCBridgeStubDateAccess 181 181 +0.0% 1.00x
PrefixArrayLazy 29 29 +0.0% 1.00x
ArrayValueProp3 6 6 +0.0% 1.00x
SuffixAnySeqCntRange 40 40 +0.0% 1.00x
ObserverPartiallyAppliedMethod 3795 3813 +0.5% 1.00x(?)
PrefixAnySeqCntRange 115 115 +0.0% 1.00x
ArraySubscript 1476 1494 +1.2% 0.99x(?)
DictionarySwapOfObjects 6895 6943 +0.7% 0.99x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 43449 43912 +1.1% 0.99x(?)
ObjectiveCBridgeFromNSStringForced 2351 2372 +0.9% 0.99x(?)
ArrayAppendLazyMap 994 1000 +0.6% 0.99x(?)
LazilyFilteredRange 6933 7016 +1.2% 0.99x
PrefixAnyCollection 126 127 +0.8% 0.99x
ObjectiveCBridgeFromNSSetAnyObject 75343 76125 +1.0% 0.99x(?)
ArrayAppendLatin1 43189 43571 +0.9% 0.99x
CharacterLiteralsLarge 10577 10663 +0.8% 0.99x(?)
StrComplexWalk 984 992 +0.8% 0.99x(?)
ArrayAppendOptionals 1215 1229 +1.1% 0.99x(?)
MapReduceSequence 463 466 +0.7% 0.99x(?)
MapReduceShort 1911 1933 +1.1% 0.99x(?)
DictionaryRemoveOfObjects 23245 23370 +0.5% 0.99x(?)
ObjectiveCBridgeStubURLAppendPath 213893 216289 +1.1% 0.99x(?)
SortStringsUnicode 7784 7878 +1.2% 0.99x
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 97166 98109 +1.0% 0.99x(?)
ObjectiveCBridgeStubToArrayOfNSString 27691 27973 +1.0% 0.99x(?)
MapReduceClassShort 4533 4594 +1.4% 0.99x(?)
StringHasSuffix 673 678 +0.7% 0.99x(?)
ArrayAppendAscii 19784 19923 +0.7% 0.99x(?)
SetUnion_OfObjects 7920 7999 +1.0% 0.99x(?)
DictionaryRemove 3185 3223 +1.2% 0.99x
DropWhileAnySeqCntRangeLazy 86 87 +1.2% 0.99x
ObserverForwarderStruct 1090 1102 +1.1% 0.99x(?)
DeadArray 181 183 +1.1% 0.99x(?)
StringWalk 5996 6077 +1.4% 0.99x(?)
ObjectiveCBridgeStubFromArrayOfNSString 28306 28498 +0.7% 0.99x(?)
ObjectiveCBridgeStubNSDataAppend 2268 2284 +0.7% 0.99x(?)
SuffixAnyCollection 52 53 +1.9% 0.98x
ObjectiveCBridgeStubFromNSDateRef 3580 3640 +1.7% 0.98x
ObjectiveCBridgeStubURLAppendPathRef 212328 216202 +1.8% 0.98x(?)
DropWhileCountableRangeLazy 79 81 +2.5% 0.98x
NSDictionaryCastToSwift 5336 5439 +1.9% 0.98x(?)
SetUnion 2443 2487 +1.8% 0.98x(?)
StringMatch 20173 20694 +2.6% 0.97x
PrefixWhileCountableRange 35 36 +2.9% 0.97x
MapReduceLazyCollectionShort 43 45 +4.7% 0.96x
ObjectiveCBridgeStubFromNSString 910 952 +4.6% 0.96x
DropWhileAnySeqCRangeIter 22273 23152 +4.0% 0.96x
CaptureProp 4650 4917 +5.7% 0.95x(?)
**Unoptimized (Onone)**
Regression (1)
TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
StringAdder 43 46 +7.0% 0.93x
Improvement (1)
TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
StringHasPrefix 1672 1547 -7.5% 1.08x
No Changes (266)
TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
DictionaryRemove 22226 21244 -4.4% 1.05x
StaticArray 4800 4571 -4.8% 1.05x
PrefixAnySeqCRangeIter 24861 23990 -3.5% 1.04x
DropFirstArray 6434 6193 -3.8% 1.04x
PrefixWhileAnyCollectionLazy 23555 22587 -4.1% 1.04x
DropLastArray 2149 2074 -3.5% 1.04x
SuffixArray 2148 2073 -3.5% 1.04x
PrefixWhileAnyCollection 37401 36486 -2.5% 1.03x
DropLastAnySeqCRangeIter 44606 43439 -2.6% 1.03x
PrefixArray 6410 6194 -3.4% 1.03x
DropLastAnyCollection 6669 6502 -2.5% 1.03x
ArrayAppend 4037 3921 -2.9% 1.03x
DropWhileCountableRange 6264 6105 -2.5% 1.03x(?)
SuffixAnyCollection 6680 6514 -2.5% 1.03x
DropFirstAnyCollectionLazy 139540 135712 -2.7% 1.03x(?)
ArrayAppendReserved 3657 3536 -3.3% 1.03x
DropWhileAnySeqCntRangeLazy 27869 27324 -2.0% 1.02x
DictionarySwap 5493 5402 -1.7% 1.02x
ObjectiveCBridgeFromNSString 4051 3984 -1.6% 1.02x(?)
PrefixWhileCountableRangeLazy 22274 21894 -1.7% 1.02x(?)
PrefixWhileAnySeqCntRange 37341 36511 -2.2% 1.02x
SuffixAnySeqCRangeIter 41994 41309 -1.6% 1.02x
ObjectiveCBridgeStubFromNSDateRef 4019 3958 -1.5% 1.02x
DictionarySwapOfObjects 19549 19247 -1.5% 1.02x
DropWhileAnySeqCntRange 25543 24926 -2.4% 1.02x(?)
DropWhileAnyCollectionLazy 27769 27109 -2.4% 1.02x
DropFirstAnySeqCRangeIter 30588 29850 -2.4% 1.02x
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 102283 100233 -2.0% 1.02x(?)
ObjectiveCBridgeFromNSArrayAnyObject 25439 24837 -2.4% 1.02x(?)
LazilyFilteredRange 1289094 1258060 -2.4% 1.02x
MapReduceShortString 277 272 -1.8% 1.02x(?)
DropWhileAnyCollection 25504 24950 -2.2% 1.02x
HashQuadratic 50221656 49425656 -1.6% 1.02x
SuffixAnyCollectionLazy 46043 45110 -2.0% 1.02x(?)
PrefixAnyCollection 20009 19546 -2.3% 1.02x(?)
ObjectiveCBridgeFromNSSetAnyObjectForced 8335 8161 -2.1% 1.02x(?)
StringMatch 74068 72839 -1.7% 1.02x
DropWhileAnySeqCRangeIterLazy 27902 27419 -1.7% 1.02x
DropFirstAnyCollection 19904 19491 -2.1% 1.02x(?)
PrefixWhileCountableRange 17890 17562 -1.8% 1.02x
StringHasSuffixUnicode 63928 62961 -1.5% 1.02x
DropWhileSequenceLazy 11271 11212 -0.5% 1.01x(?)
DropFirstAnySeqCRangeIterLazy 30387 29989 -1.3% 1.01x
Histogram 8726 8679 -0.5% 1.01x(?)
ObjectiveCBridgeToNSArray 29432 29167 -0.9% 1.01x(?)
DropLastAnySeqCRangeIterLazy 44106 43851 -0.6% 1.01x(?)
OpenClose 413 410 -0.7% 1.01x(?)
PrefixAnyCollectionLazy 137037 135843 -0.9% 1.01x(?)
ReversedDictionary 25485 25279 -0.8% 1.01x
DropWhileAnySequenceLazy 12437 12276 -1.3% 1.01x
StringUTF16Builder 3855 3807 -1.2% 1.01x(?)
ObjectiveCBridgeStubToNSDate 14935 14731 -1.4% 1.01x(?)
ArrayAppendOptionals 1306 1299 -0.5% 1.01x(?)
ArrayPlusEqualSingleElementCollection 273768 272149 -0.6% 1.01x(?)
StrToInt 7999 7903 -1.2% 1.01x
PrefixAnySequence 11857 11775 -0.7% 1.01x
PrefixAnySeqCRangeIterLazy 24490 24318 -0.7% 1.01x(?)
NSError 747 740 -0.9% 1.01x(?)
DropLastAnyCollectionLazy 45854 45355 -1.1% 1.01x(?)
PopFrontArrayGeneric 8860 8746 -1.3% 1.01x
Calculator 1003 989 -1.4% 1.01x(?)
DropFirstSequenceLazy 12984 12847 -1.1% 1.01x
IterateData 12852 12750 -0.8% 1.01x
PrefixWhileArray 16979 16886 -0.6% 1.01x(?)
ObjectiveCBridgeStubURLAppendPath 216543 215168 -0.6% 1.01x(?)
MapReduceLazySequence 25585 25402 -0.7% 1.01x
SetExclusiveOr 21339 21224 -0.5% 1.01x
Dictionary 1956 1943 -0.7% 1.01x(?)
SetIntersect 10857 10716 -1.3% 1.01x(?)
PrefixWhileArrayLazy 14852 14747 -0.7% 1.01x(?)
NSDictionaryCastToSwift 6647 6612 -0.5% 1.01x(?)
ObjectiveCBridgeToNSDictionary 61408 61089 -0.5% 1.01x(?)
ReversedBidirectional 145392 143290 -1.4% 1.01x(?)
SetIsSubsetOf_OfObjects 1531 1509 -1.4% 1.01x
ObjectiveCBridgeToNSSet 36838 36473 -1.0% 1.01x(?)
DropWhileCountableRangeLazy 26800 26487 -1.2% 1.01x(?)
StringHasPrefixUnicode 16245 16016 -1.4% 1.01x
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 75523 74993 -0.7% 1.01x(?)
RGBHistogramOfObjects 98798 98257 -0.6% 1.01x(?)
PrefixWhileAnySequence 29735 29574 -0.5% 1.01x(?)
ObjectiveCBridgeStubNSDataAppend 2655 2641 -0.5% 1.01x(?)
BitCount 882 877 -0.6% 1.01x(?)
DropLastAnySeqCntRange 6557 6501 -0.8% 1.01x
267 63779053 63184141 -0.9% 1.01x
DropFirstAnySequenceLazy 14043 13921 -0.9% 1.01x
DropFirstAnySequence 14957 14846 -0.7% 1.01x
PrefixWhileAnySeqCntRangeLazy 22996 22776 -1.0% 1.01x(?)
ObjectiveCBridgeStubFromNSDate 4146 4093 -1.3% 1.01x(?)
SuffixAnySeqCntRange 6538 6493 -0.7% 1.01x
DropLastSequence 29177 29226 +0.2% 1.00x(?)
DropLastSequenceLazy 28839 28903 +0.2% 1.00x(?)
ArraySubscript 4164 4159 -0.1% 1.00x(?)
ObjectiveCBridgeToNSString 1311 1312 +0.1% 1.00x
MonteCarloPi 52623 52647 +0.1% 1.00x(?)
PrefixWhileAnySeqCRangeIter 41093 41173 +0.2% 1.00x(?)
RecursiveOwnedParameter 9624 9626 +0.0% 1.00x(?)
Integrate 398 398 +0.0% 1.00x
PrefixSequenceLazy 11003 10958 -0.4% 1.00x
ClassArrayGetter 930 930 +0.0% 1.00x
Array2D 608250 606198 -0.3% 1.00x(?)
SortStrings 2781 2773 -0.3% 1.00x
DictionaryBridge 2840 2840 +0.0% 1.00x
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 8122 8145 +0.3% 1.00x(?)
ProtocolDispatch2 490 490 +0.0% 1.00x
ReversedArray 590 588 -0.3% 1.00x(?)
StringWithCString 334282 334307 +0.0% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 7829 7855 +0.3% 1.00x(?)
Prims 8994 8964 -0.3% 1.00x(?)
DropFirstCountableRange 339 340 +0.3% 1.00x
SortLettersInPlace 2817 2827 +0.3% 1.00x(?)
ArrayAppendToFromGeneric 660 660 +0.0% 1.00x
MapReduceString 2611 2616 +0.2% 1.00x(?)
ObjectiveCBridgeFromNSDictionaryAnyObject 140233 140340 +0.1% 1.00x(?)
RangeAssignment 5750 5767 +0.3% 1.00x(?)
MapReduceLazyCollectionShort 44154 43968 -0.4% 1.00x(?)
PrefixAnySeqCntRangeLazy 19495 19504 +0.1% 1.00x(?)
ByteSwap 266 267 +0.4% 1.00x(?)
ArrayAppendGenericStructs 1303 1302 -0.1% 1.00x(?)
SuperChars 317795 318848 +0.3% 1.00x(?)
XorLoop 23708 23705 -0.0% 1.00x(?)
StringInterpolation 12172 12192 +0.2% 1.00x(?)
ObserverClosure 6639 6658 +0.3% 1.00x(?)
AnyHashableWithAClass 85477 85213 -0.3% 1.00x(?)
CharacterLiteralsSmall 971 970 -0.1% 1.00x
DropFirstAnySeqCntRangeLazy 19513 19521 +0.0% 1.00x(?)
ObjectiveCBridgeStubToNSString 1554 1551 -0.2% 1.00x(?)
ArrayAppendStrings 13701 13730 +0.2% 1.00x(?)
Join 1254 1257 +0.2% 1.00x(?)
ArrayOfRef 8599 8600 +0.0% 1.00x(?)
PrefixAnySequenceLazy 11949 11988 +0.3% 1.00x
ObjectAllocation 626 629 +0.5% 1.00x(?)
SortSortedStrings 1404 1410 +0.4% 1.00x
ProtocolDispatch 7188 7188 +0.0% 1.00x
ArrayLiteral 1487 1491 +0.3% 1.00x(?)
ArrayAppendLatin1 99841 99735 -0.1% 1.00x(?)
CharacterLiteralsLarge 10797 10769 -0.3% 1.00x(?)
Walsh 12004 11970 -0.3% 1.00x
Dictionary2 3804 3814 +0.3% 1.00x(?)
SetIntersect_OfObjects 11180 11207 +0.2% 1.00x
ErrorHandling 3992 4009 +0.4% 1.00x(?)
ObserverUnappliedMethod 8412 8399 -0.1% 1.00x(?)
ArrayPlusEqualArrayOfInt 657 659 +0.3% 1.00x(?)
PrefixCountableRange 340 340 +0.0% 1.00x
ObjectiveCBridgeStubToNSDateRef 3385 3385 +0.0% 1.00x
DropFirstSequence 12958 13011 +0.4% 1.00x(?)
ObjectiveCBridgeStubToNSStringRef 148 148 +0.0% 1.00x
ArrayAppendFromGeneric 661 660 -0.1% 1.00x(?)
ObjectiveCBridgeStubDateMutation 515 515 +0.0% 1.00x
MapReduceSequence 41258 41371 +0.3% 1.00x(?)
MapReduceShort 49842 49962 +0.2% 1.00x(?)
DictionaryLiteral 13329 13354 +0.2% 1.00x(?)
Hanoi 16705 16780 +0.5% 1.00x(?)
DictionaryRemoveOfObjects 54995 54854 -0.3% 1.00x(?)
LazilyFilteredArrays 2713952 2711619 -0.1% 1.00x(?)
SetIsSubsetOf 1618 1619 +0.1% 1.00x(?)
SuffixAnySequenceLazy 26780 26911 +0.5% 1.00x(?)
NopDeinit 53294 53292 -0.0% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectToString 85845 86091 +0.3% 1.00x(?)
StringBuilder 2869 2865 -0.1% 1.00x(?)
ArrayInClass 4734 4734 +0.0% 1.00x
ArrayOfGenericRef 9632 9630 -0.0% 1.00x(?)
Phonebook 21836 21743 -0.4% 1.00x
Sim2DArray 30032 30039 +0.0% 1.00x(?)
PopFrontArray 9793 9802 +0.1% 1.00x(?)
SetExclusiveOr_OfObjects 41239 41251 +0.0% 1.00x(?)
StringEdits 695511 697337 +0.3% 1.00x(?)
ArrayAppendAscii 81908 81689 -0.3% 1.00x(?)
MonteCarloE 134716 135301 +0.4% 1.00x
SetUnion_OfObjects 29885 29738 -0.5% 1.00x
GlobalClass 0 0 +0.0% 1.00x
ArrayAppendToGeneric 661 661 +0.0% 1.00x
HashTest 18394 18486 +0.5% 1.00x(?)
DropWhileAnySequence 16205 16244 +0.2% 1.00x(?)
LinkedList 33163 33179 +0.1% 1.00x(?)
SuffixCountableRange 119 119 +0.0% 1.00x
MapReduceAnyCollection 37724 37744 +0.1% 1.00x(?)
MapReduce 37815 37739 -0.2% 1.00x(?)
ArrayAppendArrayOfInt 657 657 +0.0% 1.00x
DropFirstAnySeqCntRange 19474 19537 +0.3% 1.00x
Chars 7404 7372 -0.4% 1.00x(?)
MapReduceLazyCollection 32459 32592 +0.4% 1.00x(?)
ObjectiveCBridgeStubNSDateRefAccess 1208 1208 +0.0% 1.00x
PolymorphicCalls 2901 2887 -0.5% 1.00x
ObserverForwarderStruct 4724 4704 -0.4% 1.00x
CStringLongNonAscii 4109 4104 -0.1% 1.00x(?)
DropWhileSequence 15462 15441 -0.1% 1.00x(?)
DropLastAnySequenceLazy 29194 29264 +0.2% 1.00x(?)
DeadArray 118594 118658 +0.1% 1.00x(?)
AngryPhonebook 3099 3105 +0.2% 1.00x(?)
SevenBoom 1613 1618 +0.3% 1.00x(?)
DropLastCountableRange 119 119 +0.0% 1.00x
ArrayValueProp 3048 3044 -0.1% 1.00x(?)
MapReduceClass 43142 43165 +0.1% 1.00x(?)
Memset 43989 43985 -0.0% 1.00x(?)
SuffixAnySeqCRangeIterLazy 42037 41957 -0.2% 1.00x(?)
Dictionary2OfObjects 6096 6116 +0.3% 1.00x(?)
ArrayValueProp2 3647 3653 +0.2% 1.00x(?)
ArrayValueProp3 3441 3442 +0.0% 1.00x(?)
ObserverPartiallyAppliedMethod 8094 8087 -0.1% 1.00x(?)
PrefixAnySeqCntRange 19463 19444 -0.1% 1.00x(?)
StackPromo 98847 99755 +0.9% 0.99x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 44951 45584 +1.4% 0.99x(?)
Dictionary3OfObjects 2324 2347 +1.0% 0.99x(?)
ArrayAppendLazyMap 209047 212061 +1.4% 0.99x
ArrayPlusEqualFiveElementCollection 275118 277465 +0.8% 0.99x
SuffixAnySequence 27029 27248 +0.8% 0.99x
DropLastAnySeqCntRangeLazy 6515 6610 +1.5% 0.99x(?)
ObjectiveCBridgeStubFromNSStringRef 204 207 +1.5% 0.99x
ObjectiveCBridgeFromNSSetAnyObject 75352 76394 +1.4% 0.99x(?)
DropLastAnySequence 29328 29576 +0.8% 0.99x
Dictionary3 1491 1499 +0.5% 0.99x(?)
PrefixSequence 10763 10864 +0.9% 0.99x(?)
DictionaryOfObjects 4884 4911 +0.6% 0.99x(?)
StringEqualPointerComparison 9905 9967 +0.6% 0.99x(?)
PrefixWhileAnySeqCRangeIterLazy 22970 23285 +1.4% 0.99x
MapReduceAnyCollectionShort 50062 50403 +0.7% 0.99x(?)
PrefixWhileSequence 28396 28677 +1.0% 0.99x
ArrayAppendUTF16 97388 98798 +1.4% 0.99x
UTF8Decode 37054 37270 +0.6% 0.99x
ObjectiveCBridgeStubToArrayOfNSString 28250 28582 +1.2% 0.99x(?)
CStringShortAscii 8788 8864 +0.9% 0.99x(?)
ObjectiveCBridgeStubDataAppend 3703 3727 +0.7% 0.99x(?)
MapReduceClassShort 54010 54295 +0.5% 0.99x(?)
CStringLongAscii 12892 13019 +1.0% 0.99x(?)
DropWhileArrayLazy 16866 17096 +1.4% 0.99x
DropFirstArrayLazy 45372 45993 +1.4% 0.99x(?)
SuffixAnySeqCntRangeLazy 6523 6568 +0.7% 0.99x
NSStringConversion 1322 1338 +1.2% 0.99x
RGBHistogram 33593 34092 +1.5% 0.99x
SetUnion 11987 12158 +1.4% 0.99x
SuffixSequenceLazy 26358 26592 +0.9% 0.99x
SuffixSequence 26406 26700 +1.1% 0.99x
DropWhileArray 9933 10031 +1.0% 0.99x
ObjectiveCBridgeStubFromArrayOfNSString 28735 29113 +1.3% 0.99x(?)
SuffixArrayLazy 15297 15432 +0.9% 0.99x(?)
RC4 19571 19823 +1.3% 0.99x
ArrayValueProp4 3339 3357 +0.5% 0.99x
TwoSum 4334 4365 +0.7% 0.99x(?)
ObjectiveCBridgeStubDateAccess 1009 1016 +0.7% 0.99x(?)
PrefixWhileAnySequenceLazy 11106 11337 +2.1% 0.98x
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 108676 110790 +1.9% 0.98x(?)
ObjectiveCBridgeFromNSStringForced 2707 2763 +2.1% 0.98x
ObjectiveCBridgeStubFromNSString 959 982 +2.4% 0.98x
TypeFlood 168 171 +1.8% 0.98x(?)
StrComplexWalk 5965 6061 +1.6% 0.98x
PopFrontUnsafePointer 97302 99154 +1.9% 0.98x
PrefixWhileSequenceLazy 10380 10543 +1.6% 0.98x
PrefixArrayLazy 45371 46280 +2.0% 0.98x
SortStringsUnicode 9133 9285 +1.7% 0.98x
ArrayAppendRepeatCol 212407 217525 +2.4% 0.98x
DropLastArrayLazy 15286 15562 +1.8% 0.98x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 38321 39266 +2.5% 0.98x(?)
DropFirstCountableRangeLazy 38297 39287 +2.6% 0.97x
PrefixCountableRangeLazy 38282 39327 +2.7% 0.97x
SuffixCountableRangeLazy 12767 13133 +2.9% 0.97x
ObjectiveCBridgeStubURLAppendPathRef 214416 220164 +2.7% 0.97x(?)
CaptureProp 106832 110199 +3.1% 0.97x
DropLastCountableRangeLazy 12749 13139 +3.1% 0.97x
DropWhileAnySeqCRangeIter 32446 33278 +2.6% 0.97x
StringHasSuffix 1673 1719 +2.8% 0.97x
ObjectiveCBridgeStubNSDateMutationRef 15135 15671 +3.5% 0.97x(?)
ArrayAppendSequence 74108 76766 +3.6% 0.97x
ArrayOfPOD 1832 1892 +3.3% 0.97x
StringWalk 20596 21214 +3.0% 0.97x
StringBuilderLong 1108 1155 +4.2% 0.96x
ArrayOfGenericPOD 3081 3249 +5.5% 0.95x
**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 airspeedswift force-pushed the begone-iterator.element branch from 089f44e to a8651ea Compare April 23, 2017 03:28
@airspeedswift airspeedswift changed the title [WIP do not merge] Give Sequence a top-level Element [stdlib] Give Sequence a top-level Element Apr 23, 2017
@airspeedswift
Copy link
Member Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 089f44e0941e762b542770c9ae402f4f49ed1176
Test requested by - @airspeedswift

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 089f44e0941e762b542770c9ae402f4f49ed1176
Test requested by - @airspeedswift

@airspeedswift airspeedswift force-pushed the begone-iterator.element branch from a8651ea to 8869509 Compare April 23, 2017 22:11
@airspeedswift
Copy link
Member Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - a8651ea1299ad7c6022c90d986c3f01bad6a76b6
Test requested by - @airspeedswift

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - a8651ea1299ad7c6022c90d986c3f01bad6a76b6
Test requested by - @airspeedswift

@vmanot
Copy link

vmanot commented Apr 24, 2017

Is associatedtype really necessary? Would not typealias better reflect what we're trying to accomplish here, i.e. provide a substitute for Iterator.Element?

@timvermeulen
Copy link

@vmanot Conversely, using associatedtype Element seems more natural to me, since the Element type is usually the most relevant. If you were writing a Sequence protocol, wouldn't you start with associatedtype Element and later worry about how iteration is done?

@airspeedswift
Copy link
Member Author

@timvermeulen right, that's my reasoning too. If you sat down with a blank screen but already had this feature in Swift, this is probably how you'd define it. In many cases both Element and Iterator.Element will usually be inferred. If you think about the common simple definitions of a new Collection, say, you would usually ignore Iterator and mostly focus on defining the Element in terms of what subscript returns.

@DougGregor
Copy link
Member

This is fantastic!

@airspeedswift airspeedswift force-pushed the begone-iterator.element branch from 8869509 to 16d9829 Compare April 24, 2017 19:38
@airspeedswift
Copy link
Member Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 8869509174859ca30eeca37001463b3b46e9f7fc
Test requested by - @airspeedswift

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 8869509174859ca30eeca37001463b3b46e9f7fc
Test requested by - @airspeedswift

@shahmishal
Copy link
Member

@swift-ci Please Test Source Compatibility

@airspeedswift
Copy link
Member Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 8e41a9496911a8dd26d935eb1ff50d5f7ebaaeaf
Test requested by - @airspeedswift

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 8e41a9496911a8dd26d935eb1ff50d5f7ebaaeaf
Test requested by - @airspeedswift

@airspeedswift
Copy link
Member Author

@swift-ci Please clean test linux platform

@dabrahams
Copy link
Contributor

dabrahams commented Apr 25, 2017 via email

@airspeedswift airspeedswift force-pushed the begone-iterator.element branch from 2a766d3 to c6e4764 Compare April 25, 2017 15:50
@airspeedswift airspeedswift force-pushed the begone-iterator.element branch 4 times, most recently from 91ff29b to d5b59f9 Compare May 1, 2017 16:28
@airspeedswift
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented May 1, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - d5b59f928fc696385c6cea17bb6c3ee634608e82
Test requested by - @airspeedswift

@swift-ci
Copy link
Contributor

swift-ci commented May 1, 2017

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - d5b59f928fc696385c6cea17bb6c3ee634608e82
Test requested by - @airspeedswift

@airspeedswift airspeedswift force-pushed the begone-iterator.element branch 2 times, most recently from 964b8ad to ea54d07 Compare May 3, 2017 22:08
@airspeedswift
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented May 4, 2017

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - d5b59f928fc696385c6cea17bb6c3ee634608e82
Test requested by - @airspeedswift

@swift-ci
Copy link
Contributor

swift-ci commented May 4, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - d5b59f928fc696385c6cea17bb6c3ee634608e82
Test requested by - @airspeedswift

@airspeedswift airspeedswift force-pushed the begone-iterator.element branch 3 times, most recently from 75c0d64 to dc9e3b7 Compare May 6, 2017 02:56
@airspeedswift airspeedswift force-pushed the begone-iterator.element branch from dc9e3b7 to 59cca24 Compare May 6, 2017 19:39
@airspeedswift
Copy link
Member Author

Folded into #8990

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.

7 participants