Skip to content
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

Add a lot of resilience-related annotations to stdlib to improve the performance of the resilient stdlib #7350

Merged
merged 2 commits into from Mar 17, 2017

Conversation

swiftix
Copy link
Contributor

@swiftix swiftix commented Feb 9, 2017

No description provided.

@swiftix
Copy link
Contributor Author

swiftix commented Feb 9, 2017

@airspeedswift @dabrahams This is the initial set of annotations, which results in a pretty good performance for many of our benchmarks. Please have a look to see if I touched something that should not be made @_inlineable, @_versioned or @_fixed_layout.

The PR does not pass testing yet, because there are about 10 tests that need to be updated.

@swiftix
Copy link
Contributor Author

swiftix commented Feb 9, 2017

@slavapestov If you take this PR and revert the last commit: 17ed6ba, then you get a compiler crasher. Could you have a look? I hope it is easy to fix, just like the previous resilience related bugs I've reported.

@slavapestov
Copy link
Member

I'll take a look, thanks @swiftix.

@slavapestov
Copy link
Member

@swiftix Designated initializers on classes cannot be @_inlineable for the same reason as designated initializers on non-fixed-layout value types. Is it important for these initializers to be inlineable? If not, I'll add a diagnostic prohibiting them. If so, we should discuss some options.

@swiftix
Copy link
Contributor Author

swiftix commented Feb 18, 2017

@slavapestov Thanks for improving the diagnostics. One minor annoying thing I noticed: when the compiler produces a diagnostics that @_inlinable cannot be used with stored properties, it does not show the name of the stored property. Could you add the name of the properties to the message? it is very annoying to search by the line number in gyb generated Swift files ;-) Searching by name in the original gyb/swift files is much easier.

@dabrahams
Copy link
Collaborator

dabrahams commented Feb 19, 2017 via email

@swiftix
Copy link
Contributor Author

swiftix commented Mar 1, 2017

@airspeedswift @dabrahams Ping! I rebased on ToT. Please have a look. In particular, check if I put @_fixed_layout or @_versioned on types, where you do not want to expose the representation or any details about it.

@swiftix
Copy link
Contributor Author

swiftix commented Mar 2, 2017

@swift-ci please smoke test

@@ -17,6 +17,7 @@ let arrayCount = 1024

// This test case exposes rdar://17440222 which caused rdar://17974483 (popFront
// being really slow).
@_versioned
Copy link
Member

Choose a reason for hiding this comment

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

Why did the benchmark change?

@@ -75,6 +75,8 @@ public func autoreleasepoolIfUnoptimizedReturnAutoreleased(
#endif
}

@_inlineable
@_versioned
Copy link
Member

Choose a reason for hiding this comment

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

This function has no body, it should not be @_inlineable (I'll add a diagnostic for that)

@@ -451,9 +456,9 @@ if True:
}%

${SelfDocComment}
% if Self != 'ArraySlice':
//% if Self != 'ArraySlice':
Copy link
Member

Choose a reason for hiding this comment

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

Just remove the gybbing here?

public var startIndex: Int {
%if Self == 'ArraySlice':
return _buffer.startIndex
%else:
return 0
@_inlineable
Copy link
Member

Choose a reason for hiding this comment

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

Oops, the @_inlineable should apply to the getter too. Can you revert this and I'll make sure it works?

@@ -994,6 +1046,8 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
/// emptyArray = []
/// print(emptyArray.isEmpty)
/// // Prints "true"
// @inline(__always)
Copy link
Member

Choose a reason for hiding this comment

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

Remove this line?

public mutating func next() -> Element? {
return _base.next().map(_transform)
}

@_inlineable
public var base: Base { return _base }
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this could be private(set) instead

public var underestimatedCount: Int {
return _base.underestimatedCount
}

/// Create an instance with elements `transform(x)` for each element
/// `x` of base.
//@_inlineable
Copy link
Member

Choose a reason for hiding this comment

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

Why wasn't this one inlineable?

@@ -875,6 +876,7 @@ extension String {
/// // Prints "(21, 30)"
///
/// - SeeAlso: `String.init<Subject>(reflecting: Subject)`
@_inlineable
Copy link
Member

Choose a reason for hiding this comment

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

Mirrors are not performance-critical, I think you should remove this

@@ -670,10 +676,13 @@ public func ?? <T>(optional: T?, defaultValue: @autoclosure () throws -> T?)
}

extension Optional {

@_inlineable
Copy link
Member

Choose a reason for hiding this comment

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

These are not available and should not be inlineable

@@ -386,13 +387,17 @@ internal func _print_unlocked<T, TargetStream : TextOutputStream>(
///
/// This function is forbidden from being inlined because when building the
/// standard library inlining makes us drop the special semantics.
@_inlineable
Copy link
Member

Choose a reason for hiding this comment

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

This is inline(never) so it doesn't have to be inlineable either -- you'll just end up emitting useless copies of this into client binaries

Copy link
Contributor Author

Choose a reason for hiding this comment

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

May be we want to specialize it?

Copy link
Member

Choose a reason for hiding this comment

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

I see. In practice does specializing here make a difference? Perhaps just having some pre-specializations is sufficient.

@@ -108,33 +109,43 @@ public struct CountableRange<Bound> : RandomAccessCollection
public typealias IndexDistance = Bound.Stride

public var startIndex: Index {
return lowerBound
@_inlineable
Copy link
Member

Choose a reason for hiding this comment

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

Redundant 'get {'

@@ -173,6 +184,7 @@ public struct CountableRange<Bound> : RandomAccessCollection
/// (`..<`) to form `CountableRange` instances is preferred.
///
/// - Parameter bounds: A tuple of the lower and upper bounds of the range.
@inline(__always)
Copy link
Member

Choose a reason for hiding this comment

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

Why not leave the decision up to the optimizer?

@@ -1207,6 +1238,7 @@ public func += <
public typealias RangeReplaceableCollectionType = RangeReplaceableCollection

extension RangeReplaceableCollection {
@_inlineable
Copy link
Member

Choose a reason for hiding this comment

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

Unavailable methods don't need to be inlineable

@@ -105,6 +112,7 @@ public func repeatElement<T>(_ element: T, count n: Int) -> Repeated<T> {
public struct Repeat<Element> {}

extension Repeated {
@_inlineable
Copy link
Member

Choose a reason for hiding this comment

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

Unavailable methods don't need to be inlineable

@@ -1081,6 +1132,7 @@ extension Sequence {
/// element is a match.
/// - Returns: The first element of the sequence that satisfies `predicate`,
/// or `nil` if there is no element that satisfies `predicate`.
// @_inlineable
Copy link
Member

Choose a reason for hiding this comment

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

Why wasn't this inlineable?

@@ -1429,16 +1494,19 @@ public typealias GeneratorType = IteratorProtocol
public typealias SequenceType = Sequence

extension Sequence {
@_inlineable
Copy link
Member

Choose a reason for hiding this comment

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

Unavailable methods don't need to be inlineable

final var countAndCapacity: _ArrayBody

@_inlineable
Copy link
Member

Choose a reason for hiding this comment

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

These constructors just throw errors, don't have to be inlinable

final var countAndCapacity: _ArrayBody

@_inlineable
@_versioned
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this should be versioned either, it says doNotCallMe :-)

@swiftix
Copy link
Contributor Author

swiftix commented Mar 15, 2017

@swift-ci please test

1 similar comment
@swiftix
Copy link
Contributor Author

swiftix commented Mar 15, 2017

@swift-ci please test

@swiftix
Copy link
Contributor Author

swiftix commented Mar 15, 2017

@swift-ci please smoke test

1 similar comment
@swiftix
Copy link
Contributor Author

swiftix commented Mar 15, 2017

@swift-ci please smoke test

@swiftix
Copy link
Contributor Author

swiftix commented Mar 15, 2017

@swift-ci please test

@swiftix
Copy link
Contributor Author

swiftix commented Mar 15, 2017

@swift-ci please benchmark

@swift-ci
Copy link
Collaborator

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 648debb3bd9a1b76916678c5e363d3e5e03cea8b
Test requested by - @swiftix

@swift-ci
Copy link
Collaborator

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 648debb3bd9a1b76916678c5e363d3e5e03cea8b
Test requested by - @swiftix

@swift-ci
Copy link
Collaborator

Build comment file:

Optimized (O)

Regression (6)
TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
OpenClose 45 51 +13.3% 0.88x
ObjectiveCBridgeStubNSDateRefAccess 294 323 +9.9% 0.91x
MapReduceAnyCollection 286 314 +9.8% 0.91x
ClassArrayGetter 12 13 +8.3% 0.92x
NopDeinit 20188 21616 +7.1% 0.93x
MapReduceLazyCollection 14 15 +7.1% 0.93x
Improvement (6)
TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
Hanoi 3424 3217 -6.0% 1.06x
NSStringConversion 714 673 -5.7% 1.06x(?)
LazilyFilteredRange 7316 6863 -6.2% 1.07x
Calculator 36 33 -8.3% 1.09x
Histogram 251 228 -9.2% 1.10x
DropLastSequence 4869 4396 -9.7% 1.11x
No Changes (180)
TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
StrToInt 5715 5451 -4.6% 1.05x
SortStrings 1623 1556 -4.1% 1.04x
ObjectiveCBridgeStubFromNSString 896 864 -3.6% 1.04x
SortSortedStrings 818 786 -3.9% 1.04x
DictionarySwap 360 350 -2.8% 1.03x(?)
MapReduceString 72 70 -2.8% 1.03x
Dictionary 766 747 -2.5% 1.03x
SortStringsUnicode 7280 7161 -1.6% 1.02x
PopFrontArray 1156 1133 -2.0% 1.02x(?)
StringInterpolation 8931 8763 -1.9% 1.02x(?)
CStringLongAscii 7615 7489 -1.6% 1.02x
Phonebook 7154 7010 -2.0% 1.02x(?)
ObjectiveCBridgeStubNSDateMutationRef 12193 12007 -1.5% 1.02x(?)
StringHasPrefixUnicode 13542 13321 -1.6% 1.02x
ObjectiveCBridgeToNSString 1198 1189 -0.8% 1.01x(?)
Array2D 1952 1942 -0.5% 1.01x(?)
SuperChars 220468 218452 -0.9% 1.01x(?)
DropLastAnySequence 5946 5904 -0.7% 1.01x(?)
Dictionary2 2008 1997 -0.6% 1.01x(?)
ObjectiveCBridgeStubURLAppendPathRef 212262 209572 -1.3% 1.01x(?)
ObjectiveCBridgeStubToNSDateRef 3185 3167 -0.6% 1.01x(?)
SuffixAnySequence 5942 5898 -0.7% 1.01x(?)
ObjectiveCBridgeToNSDictionary 56786 56129 -1.2% 1.01x(?)
StringEdits 493065 487837 -1.1% 1.01x
MonteCarloE 10018 9919 -1.0% 1.01x(?)
SetUnion_OfObjects 6130 6054 -1.2% 1.01x(?)
SetUnion 2045 2015 -1.5% 1.01x(?)
StringBuilder 1291 1284 -0.5% 1.01x(?)
CStringLongNonAscii 2744 2713 -1.1% 1.01x
ObjectiveCBridgeStubFromArrayOfNSString 49445 49186 -0.5% 1.01x(?)
ArraySubscript 1439 1442 +0.2% 1.00x(?)
DictionarySwapOfObjects 6544 6549 +0.1% 1.00x(?)
ObjectiveCBridgeFromNSDictionaryAnyObject 111035 111477 +0.4% 1.00x(?)
Integrate 247 247 +0.0% 1.00x
StringBuilderLong 910 910 +0.0% 1.00x
ObjectiveCBridgeFromNSArrayAnyObjectToString 40514 40692 +0.4% 1.00x(?)
StringAdder 1569 1573 +0.2% 1.00x(?)
DictionaryBridge 2882 2894 +0.4% 1.00x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 4643 4665 +0.5% 1.00x(?)
ArrayAppendLatin1 42294 42389 +0.2% 1.00x(?)
MonteCarloPi 42465 42344 -0.3% 1.00x(?)
StringWithCString 147106 146852 -0.2% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 4201 4201 +0.0% 1.00x
Prims 719 717 -0.3% 1.00x(?)
SortLettersInPlace 1094 1095 +0.1% 1.00x(?)
ReversedDictionary 110 110 +0.0% 1.00x
ArrayAppendToFromGeneric 562 562 +0.0% 1.00x
Dictionary3OfObjects 1008 1004 -0.4% 1.00x(?)
StringUTF16Builder 2088 2087 -0.1% 1.00x(?)
StringHasPrefix 573 573 +0.0% 1.00x
ByteSwap 0 0 +0.0% 1.00x
ArrayAppendGenericStructs 1135 1135 +0.0% 1.00x
ArrayAppendLazyMap 859 858 -0.1% 1.00x(?)
ArrayPlusEqualFiveElementCollection 48655 48750 +0.2% 1.00x(?)
XorLoop 333 333 +0.0% 1.00x
ArrayAppendReserved 503 503 +0.0% 1.00x
ObserverClosure 2082 2085 +0.1% 1.00x(?)
CharacterLiteralsSmall 760 759 -0.1% 1.00x(?)
ObjectiveCBridgeStubToNSString 1443 1443 +0.0% 1.00x
ArrayPlusEqualSingleElementCollection 46926 47014 +0.2% 1.00x(?)
ArrayAppendStrings 12748 12737 -0.1% 1.00x(?)
Join 472 472 +0.0% 1.00x
ProtocolDispatch 2859 2859 +0.0% 1.00x
ObjectAllocation 169 169 +0.0% 1.00x
TypeFlood 0 0 +0.0% 1.00x
MapReduceClassShort 4317 4317 +0.0% 1.00x
ObjectiveCBridgeFromNSSetAnyObject 60269 60293 +0.0% 1.00x(?)
CharacterLiteralsLarge 11553 11506 -0.4% 1.00x(?)
Walsh 334 335 +0.3% 1.00x(?)
Dictionary3 561 562 +0.2% 1.00x(?)
StrComplexWalk 2717 2722 +0.2% 1.00x(?)
SetIntersect_OfObjects 1630 1625 -0.3% 1.00x(?)
ErrorHandling 2756 2762 +0.2% 1.00x(?)
ArrayOfRef 3688 3695 +0.2% 1.00x(?)
ObserverUnappliedMethod 2544 2548 +0.2% 1.00x(?)
ArrayAppendOptionals 1136 1136 +0.0% 1.00x
DropLastArray 28 28 +0.0% 1.00x
ObjectiveCBridgeToNSArray 26630 26658 +0.1% 1.00x(?)
NSError 328 328 +0.0% 1.00x
DictionaryOfObjects 2423 2431 +0.3% 1.00x(?)
PopFrontUnsafePointer 9263 9228 -0.4% 1.00x(?)
StringEqualPointerComparison 6837 6863 +0.4% 1.00x(?)
RC4 148 148 +0.0% 1.00x
ArrayAppendFromGeneric 563 562 -0.2% 1.00x(?)
MapReduceShort 1840 1836 -0.2% 1.00x(?)
ObjectiveCBridgeStubDateMutation 257 257 +0.0% 1.00x
DictionaryLiteral 1390 1390 +0.0% 1.00x
ArrayOfGenericPOD 207 207 +0.0% 1.00x
UTF8Decode 258 258 +0.0% 1.00x
MapReduceLazySequence 85 85 +0.0% 1.00x
LazilyFilteredArrays 68854 68755 -0.1% 1.00x(?)
SetIsSubsetOf 275 275 +0.0% 1.00x
ObjectiveCBridgeStubToArrayOfNSString 26029 25941 -0.3% 1.00x(?)
CStringShortAscii 4884 4875 -0.2% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObject 22037 22147 +0.5% 1.00x(?)
SetIntersect 304 304 +0.0% 1.00x
ObjectiveCBridgeStubDataAppend 3602 3599 -0.1% 1.00x(?)
NSDictionaryCastToSwift 4934 4923 -0.2% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectToString 75144 75211 +0.1% 1.00x(?)
191 9332875 9307695 -0.3% 1.00x
ArrayOfGenericRef 3794 3802 +0.2% 1.00x(?)
ObjectiveCBridgeFromNSString 1333 1330 -0.2% 1.00x(?)
PolymorphicCalls 20 20 +0.0% 1.00x
Sim2DArray 260 260 +0.0% 1.00x
ArrayAppendRepeatCol 791 790 -0.1% 1.00x(?)
MapReduceShortString 17 17 +0.0% 1.00x
ArrayAppendAscii 18796 18808 +0.1% 1.00x(?)
ReversedBidirectional 47342 47230 -0.2% 1.00x(?)
StringHasSuffixUnicode 57502 57542 +0.1% 1.00x(?)
ArrayAppendToGeneric 562 562 +0.0% 1.00x
HashTest 1681 1680 -0.1% 1.00x(?)
SetIsSubsetOf_OfObjects 341 341 +0.0% 1.00x
HashQuadratic 5971581 5963583 -0.1% 1.00x(?)
ArrayAppend 731 732 +0.1% 1.00x(?)
DictionaryRemove 2958 2968 +0.3% 1.00x(?)
LinkedList 6724 6730 +0.1% 1.00x(?)
SuffixCountableRange 27 27 +0.0% 1.00x
MapReduce 311 311 +0.0% 1.00x
RGBHistogramOfObjects 22655 22674 +0.1% 1.00x(?)
RGBHistogram 2473 2464 -0.4% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectForced 3955 3946 -0.2% 1.00x(?)
ArrayAppendSequence 922 922 +0.0% 1.00x
ArrayAppendArrayOfInt 563 562 -0.2% 1.00x(?)
ArrayOfPOD 156 156 +0.0% 1.00x
ReversedArray 46 46 +0.0% 1.00x
ObserverForwarderStruct 1019 1019 +0.0% 1.00x
ArrayValueProp2 5 5 +0.0% 1.00x
BitCount 1 1 +0.0% 1.00x
ArrayPlusEqualArrayOfInt 562 562 +0.0% 1.00x
SevenBoom 1384 1382 -0.1% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 66844 66965 +0.2% 1.00x(?)
DropLastCountableRange 26 26 +0.0% 1.00x
SuffixSequence 4714 4710 -0.1% 1.00x(?)
StringWalk 5504 5505 +0.0% 1.00x(?)
ArrayValueProp 5 5 +0.0% 1.00x
SuffixArray 30 30 +0.0% 1.00x
MapReduceClass 2912 2923 +0.4% 1.00x(?)
StringHasSuffix 631 634 +0.5% 1.00x(?)
GlobalClass 0 0 +0.0% 1.00x
Memset 221 220 -0.5% 1.00x(?)
Dictionary2OfObjects 3488 3471 -0.5% 1.00x(?)
ArrayValueProp4 5 5 +0.0% 1.00x
TwoSum 1192 1196 +0.3% 1.00x(?)
ObjectiveCBridgeStubDateAccess 171 171 +0.0% 1.00x
ArrayValueProp3 5 5 +0.0% 1.00x
ObserverPartiallyAppliedMethod 3541 3544 +0.1% 1.00x(?)
StackPromo 21370 21551 +0.8% 0.99x
RecursiveOwnedParameter 2189 2206 +0.8% 0.99x
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 131987 133261 +1.0% 0.99x(?)
ObjectiveCBridgeFromNSStringForced 2200 2223 +1.1% 0.99x(?)
RangeAssignment 294 298 +1.4% 0.99x(?)
ObjectiveCBridgeStubToNSDate 14080 14266 +1.3% 0.99x(?)
ProtocolDispatch2 144 146 +1.4% 0.99x
ObjectiveCBridgeToNSSet 34469 34724 +0.7% 0.99x(?)
PopFrontArrayGeneric 1152 1158 +0.5% 0.99x(?)
CaptureProp 4303 4340 +0.9% 0.99x(?)
MapReduceAnyCollectionShort 2034 2045 +0.5% 0.99x(?)
ObjectiveCBridgeStubToNSStringRef 124 125 +0.8% 0.99x(?)
StringMatch 34562 34942 +1.1% 0.99x
ArrayAppendUTF16 38975 39276 +0.8% 0.99x
AngryPhonebook 2743 2761 +0.7% 0.99x(?)
DictionaryRemoveOfObjects 21132 21255 +0.6% 0.99x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 90453 91199 +0.8% 0.99x(?)
SetExclusiveOr 2367 2384 +0.7% 0.99x(?)
SetExclusiveOr_OfObjects 7467 7524 +0.8% 0.99x(?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 65780 66488 +1.1% 0.99x(?)
ArrayLiteral 1147 1153 +0.5% 0.99x(?)
ObjectiveCBridgeStubNSDataAppend 2119 2150 +1.5% 0.99x(?)
ObjectiveCBridgeStubFromNSDateRef 3519 3591 +2.0% 0.98x
MapReduceLazyCollectionShort 41 42 +2.4% 0.98x
AnyHashableWithAClass 63591 65165 +2.5% 0.98x(?)
IterateData 2532 2571 +1.5% 0.98x
ObjectiveCBridgeStubURLAppendPath 206385 211103 +2.3% 0.98x(?)
ArrayInClass 58 59 +1.7% 0.98x(?)
DeadArray 171 174 +1.8% 0.98x
ObjectiveCBridgeStubFromNSStringRef 188 193 +2.7% 0.97x
ObjectiveCBridgeStubFromNSDate 3533 3650 +3.3% 0.97x
StaticArray 138 144 +4.3% 0.96x
Chars 1378 1438 +4.3% 0.96x
MapReduceSequence 502 529 +5.4% 0.95x
**Unoptimized (Onone)**
Regression (1)
TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
PopFrontUnsafePointer 151498 166583 +10.0% 0.91x
Improvement (3)
TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
MapReduce 36753 34371 -6.5% 1.07x
MapReduceAnyCollection 38237 35492 -7.2% 1.08x
MapReduceLazyCollection 33126 30715 -7.3% 1.08x
No Changes (188)
TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
MapReduceClass 41242 39146 -5.1% 1.05x
DropLastSequence 41632 40130 -3.6% 1.04x
StringWalk 21203 20452 -3.5% 1.04x
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 6993 6787 -3.0% 1.03x
ObjectiveCBridgeStubToNSDate 14793 14341 -3.1% 1.03x(?)
CharacterLiteralsLarge 13501 13075 -3.2% 1.03x
AnyHashableWithAClass 81778 79137 -3.2% 1.03x(?)
ArrayPlusEqualSingleElementCollection 258330 249965 -3.2% 1.03x
TypeFlood 157 153 -2.5% 1.03x(?)
ArrayAppendSequence 68107 66317 -2.6% 1.03x
SortStringsUnicode 8493 8321 -2.0% 1.02x
ErrorHandling 3735 3675 -1.6% 1.02x(?)
CStringLongAscii 16367 16044 -2.0% 1.02x
DropLastArray 2003 1969 -1.7% 1.02x
NSError 676 660 -2.4% 1.02x(?)
NopDeinit 44719 44004 -1.6% 1.02x
ObjectiveCBridgeFromNSArrayAnyObject 24998 24550 -1.8% 1.02x(?)
ArrayAppendRepeatCol 195733 191799 -2.0% 1.02x
StringMatch 82535 81300 -1.5% 1.02x(?)
NSStringConversion 1216 1190 -2.1% 1.02x
StrToInt 7249 7096 -2.1% 1.02x
ObjectiveCBridgeStubNSDataAppend 2521 2480 -1.6% 1.02x(?)
SuffixSequence 39544 38607 -2.4% 1.02x
SuffixArray 2004 1967 -1.9% 1.02x
ArraySubscript 3966 3945 -0.5% 1.01x(?)
SortStrings 2552 2532 -0.8% 1.01x
ArrayAppendLatin1 97416 96780 -0.7% 1.01x
DictionarySwap 5085 5049 -0.7% 1.01x
MapReduceString 2145 2128 -0.8% 1.01x(?)
RangeAssignment 5299 5271 -0.5% 1.01x(?)
ArrayPlusEqualFiveElementCollection 256530 253041 -1.4% 1.01x
ObserverClosure 6362 6315 -0.7% 1.01x(?)
LazilyFilteredRange 1194999 1179247 -1.3% 1.01x
ObjectiveCBridgeStubFromNSString 928 921 -0.8% 1.01x(?)
StringHasSuffixUnicode 59796 59126 -1.1% 1.01x
MapReduceClassShort 49216 48628 -1.2% 1.01x(?)
ObjectiveCBridgeToNSSet 35155 34742 -1.2% 1.01x(?)
StringAdder 1729 1706 -1.3% 1.01x
Calculator 995 984 -1.1% 1.01x
ArrayAppendFromGeneric 623 619 -0.6% 1.01x
MapReduceSequence 38840 38395 -1.1% 1.01x
Dictionary 1731 1709 -1.3% 1.01x
MapReduceShortString 225 222 -1.3% 1.01x(?)
StringEdits 832194 825884 -0.8% 1.01x(?)
ArrayAppendToGeneric 625 620 -0.8% 1.01x
SetIsSubsetOf_OfObjects 1522 1509 -0.8% 1.01x(?)
StringHasPrefixUnicode 14843 14685 -1.1% 1.01x
StackPromo 91815 91784 -0.0% 1.00x(?)
RecursiveOwnedParameter 8885 8852 -0.4% 1.00x
Integrate 376 376 +0.0% 1.00x
ObjectiveCBridgeFromNSArrayAnyObjectToString 42347 42290 -0.1% 1.00x(?)
ClassArrayGetter 878 878 +0.0% 1.00x
Array2D 571675 572691 +0.2% 1.00x(?)
Histogram 8114 8122 +0.1% 1.00x(?)
ObjectiveCBridgeStubFromNSDateRef 4013 4013 +0.0% 1.00x
MonteCarloPi 50435 50435 +0.0% 1.00x
StringWithCString 324113 323977 -0.0% 1.00x(?)
Prims 8468 8432 -0.4% 1.00x(?)
SortLettersInPlace 2557 2568 +0.4% 1.00x
ReversedDictionary 23424 23431 +0.0% 1.00x(?)
ArrayAppendToFromGeneric 621 618 -0.5% 1.00x
ObjectiveCBridgeFromNSDictionaryAnyObject 114045 113883 -0.1% 1.00x(?)
Dictionary3OfObjects 2178 2177 -0.1% 1.00x(?)
StringUTF16Builder 3528 3544 +0.5% 1.00x(?)
MapReduceLazyCollectionShort 40398 40503 +0.3% 1.00x(?)
StrComplexWalk 8129 8122 -0.1% 1.00x(?)
ByteSwap 9 9 +0.0% 1.00x
ArrayAppendGenericStructs 1199 1196 -0.2% 1.00x(?)
SuperChars 267558 266765 -0.3% 1.00x(?)
XorLoop 21517 21517 +0.0% 1.00x
CharacterLiteralsSmall 972 972 +0.0% 1.00x
ObjectiveCBridgeStubToNSString 1477 1481 +0.3% 1.00x(?)
ArrayAppendStrings 12844 12847 +0.0% 1.00x(?)
ObjectiveCBridgeStubFromNSStringRef 234 235 +0.4% 1.00x(?)
StaticArray 4314 4334 +0.5% 1.00x
ProtocolDispatch 6616 6619 +0.1% 1.00x(?)
ObjectAllocation 600 598 -0.3% 1.00x(?)
SortSortedStrings 1334 1332 -0.1% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObject 63916 63853 -0.1% 1.00x(?)
ArrayLiteral 1398 1400 +0.1% 1.00x(?)
ProtocolDispatch2 402 402 +0.0% 1.00x
ArrayPlusEqualArrayOfInt 618 617 -0.2% 1.00x
Walsh 11218 11234 +0.1% 1.00x(?)
StringBuilderLong 1086 1083 -0.3% 1.00x(?)
Dictionary3 1370 1364 -0.4% 1.00x(?)
Dictionary2 3596 3583 -0.4% 1.00x(?)
Join 1244 1244 +0.0% 1.00x
ArrayOfRef 8128 8117 -0.1% 1.00x(?)
ObserverUnappliedMethod 8014 8014 +0.0% 1.00x
ArrayAppendOptionals 1196 1196 +0.0% 1.00x
ObjectiveCBridgeStubToNSDateRef 3295 3290 -0.1% 1.00x(?)
CaptureProp 97193 96729 -0.5% 1.00x(?)
ObjectiveCBridgeStubDateMutation 486 486 +0.0% 1.00x
MapReduceShort 44373 44256 -0.3% 1.00x(?)
ArrayAppendUTF16 96701 96228 -0.5% 1.00x(?)
IterateData 10457 10496 +0.4% 1.00x
DictionaryLiteral 12441 12414 -0.2% 1.00x(?)
Hanoi 15975 15983 +0.1% 1.00x(?)
UTF8Decode 35021 34980 -0.1% 1.00x(?)
LazilyFilteredArrays 2584337 2586885 +0.1% 1.00x(?)
SetIsSubsetOf 1535 1535 +0.0% 1.00x
ObjectiveCBridgeStubToArrayOfNSString 25801 25705 -0.4% 1.00x(?)
SetExclusiveOr 19605 19579 -0.1% 1.00x(?)
NSDictionaryCastToSwift 5927 5952 +0.4% 1.00x(?)
ObjectiveCBridgeStubNSDateRefAccess 1142 1140 -0.2% 1.00x(?)
ArrayInClass 4292 4293 +0.0% 1.00x(?)
ArrayOfGenericRef 9114 9129 +0.2% 1.00x(?)
Phonebook 20506 20462 -0.2% 1.00x(?)
PolymorphicCalls 743 742 -0.1% 1.00x(?)
Sim2DArray 27953 27947 -0.0% 1.00x(?)
SetExclusiveOr_OfObjects 38837 38787 -0.1% 1.00x(?)
ObjectiveCBridgeToNSDictionary 56710 56805 +0.2% 1.00x(?)
ArrayAppendAscii 76682 76877 +0.2% 1.00x
MonteCarloE 79577 79495 -0.1% 1.00x(?)
SetUnion_OfObjects 27948 27918 -0.1% 1.00x(?)
ReversedBidirectional 133386 133044 -0.3% 1.00x(?)
RC4 6885 6862 -0.3% 1.00x
HashTest 5703 5702 -0.0% 1.00x(?)
DictionaryRemove 17743 17733 -0.1% 1.00x(?)
LinkedList 31103 31134 +0.1% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 69858 70011 +0.2% 1.00x(?)
RGBHistogramOfObjects 81350 81659 +0.4% 1.00x(?)
RGBHistogram 30038 29961 -0.3% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectForced 6588 6556 -0.5% 1.00x(?)
ArrayAppendArrayOfInt 619 616 -0.5% 1.00x
ArrayOfPOD 1784 1784 +0.0% 1.00x
SetUnion 10977 10930 -0.4% 1.00x
Chars 7645 7651 +0.1% 1.00x(?)
ReversedArray 555 556 +0.2% 1.00x(?)
ObserverForwarderStruct 4403 4424 +0.5% 1.00x(?)
CStringLongNonAscii 4181 4174 -0.2% 1.00x(?)
AngryPhonebook 2900 2907 +0.2% 1.00x(?)
SevenBoom 1513 1510 -0.2% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 68887 68780 -0.2% 1.00x(?)
DropLastCountableRange 136 136 +0.0% 1.00x
ArrayValueProp4 3149 3140 -0.3% 1.00x
ObjectiveCBridgeStubFromArrayOfNSString 50007 49831 -0.3% 1.00x(?)
GlobalClass 0 0 +0.0% 1.00x
Memset 42115 42115 +0.0% 1.00x
Dictionary2OfObjects 5864 5837 -0.5% 1.00x(?)
TwoSum 4435 4452 +0.4% 1.00x(?)
ObjectiveCBridgeStubDateAccess 972 972 +0.0% 1.00x
ArrayValueProp2 3435 3448 +0.4% 1.00x(?)
ArrayValueProp3 3242 3241 -0.0% 1.00x(?)
ObserverPartiallyAppliedMethod 7656 7668 +0.2% 1.00x
ObjectiveCBridgeToNSString 1233 1240 +0.6% 0.99x(?)
PopFrontArray 10259 10315 +0.6% 0.99x
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 135902 137693 +1.3% 0.99x(?)
ArrayAppendLazyMap 211402 213925 +1.2% 0.99x(?)
StringInterpolation 13992 14074 +0.6% 0.99x(?)
SetIntersect_OfObjects 10415 10568 +1.5% 0.99x
ObjectiveCBridgeToNSArray 26942 27218 +1.0% 0.99x(?)
DictionaryOfObjects 4491 4531 +0.9% 0.99x(?)
PopFrontArrayGeneric 7653 7760 +1.4% 0.99x
StringEqualPointerComparison 9030 9119 +1.0% 0.99x
MapReduceAnyCollectionShort 44745 45012 +0.6% 0.99x(?)
ObjectiveCBridgeStubToNSStringRef 159 160 +0.6% 0.99x
DictionaryRemoveOfObjects 49938 50310 +0.7% 0.99x(?)
MapReduceLazySequence 25561 25928 +1.4% 0.99x
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 92342 92938 +0.7% 0.99x(?)
CStringShortAscii 8611 8667 +0.7% 0.99x
SetIntersect 9921 10063 +1.4% 0.99x
ObjectiveCBridgeFromNSSetAnyObjectToString 81078 82108 +1.3% 0.99x(?)
StringBuilder 2674 2699 +0.9% 0.99x(?)
SuffixCountableRange 135 136 +0.7% 0.99x(?)
DeadArray 116603 117711 +0.9% 0.99x(?)
BitCount 96 97 +1.0% 0.99x
ArrayValueProp 2840 2859 +0.7% 0.99x
ObjectiveCBridgeFromNSString 3774 3802 +0.7% 0.99x(?)
ObjectiveCBridgeStubFromNSDate 3867 3905 +1.0% 0.99x
DictionarySwapOfObjects 18478 18925 +2.4% 0.98x(?)
DropLastAnySequence 6187 6324 +2.2% 0.98x
DictionaryBridge 2965 3018 +1.8% 0.98x(?)
ObjectiveCBridgeFromNSStringForced 2531 2576 +1.8% 0.98x
ObjectiveCBridgeStubURLAppendPathRef 208788 214024 +2.5% 0.98x(?)
ArrayOfGenericPOD 2885 2957 +2.5% 0.98x
SuffixAnySequence 6190 6346 +2.5% 0.98x(?)
ObjectiveCBridgeStubNSDateMutationRef 14223 14586 +2.5% 0.98x(?)
ArrayAppend 3308 3368 +1.8% 0.98x
ObjectiveCBridgeFromNSArrayAnyObjectForced 7419 7629 +2.8% 0.97x(?)
ObjectiveCBridgeStubURLAppendPath 209969 217149 +3.4% 0.97x(?)
ObjectiveCBridgeStubDataAppend 3575 3667 +2.6% 0.97x
ArrayAppendReserved 3233 3344 +3.4% 0.97x
191 58223648 60448233 +3.8% 0.96x
StringHasSuffix 1527 1584 +3.7% 0.96x
StringHasPrefix 1430 1501 +5.0% 0.95x
OpenClose 379 399 +5.3% 0.95x(?)
HashQuadratic 46851011 49373539 +5.4% 0.95x
**Hardware Overview** Model Name: Mac mini Model Identifier: Macmini7,1 Processor Name: Intel Core i7 Processor Speed: 3 GHz Number of Processors: 1 Total Number of Cores: 2 L2 Cache (per Core): 256 KB L3 Cache: 4 MB Memory: 16 GB

@swiftix
Copy link
Contributor Author

swiftix commented Mar 17, 2017

@swift-ci please test

1 similar comment
@swiftix
Copy link
Contributor Author

swiftix commented Mar 17, 2017

@swift-ci please test

… mode, when -sil-serialize-all is disabled

This commit mostly improves the performance of arrays and ranges.
It does not cover Strings, Dictionaries and Sets yet.
@swiftix
Copy link
Contributor Author

swiftix commented Mar 17, 2017

@swift-ci please test

@swift-ci
Copy link
Collaborator

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 3f40824f3d45579f2e0f6d2ae8cbd89d9cd40e95
Test requested by - @swiftix

@swift-ci
Copy link
Collaborator

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 3f40824f3d45579f2e0f6d2ae8cbd89d9cd40e95
Test requested by - @swiftix

@swiftix
Copy link
Contributor Author

swiftix commented Mar 17, 2017

@swift-ci please smoke test

1 similar comment
@swiftix
Copy link
Contributor Author

swiftix commented Mar 17, 2017

@swift-ci please smoke test

@swiftix swiftix merged commit 397d801 into apple:master Mar 17, 2017
swiftix added a commit to swiftix/swift that referenced this pull request Mar 17, 2017
swiftix added a commit that referenced this pull request Mar 17, 2017
Un-XFAIL some tests which are passing now, after merging PR #7350
@dabrahams
Copy link
Collaborator

dabrahams commented Mar 18, 2017

Having merged this into my branch I am getting piles of errors like

error: instance method '_forceCreateUniqueMutableBuffer(countForNewBuffer:minNewCapacity:)' is internal and cannot be referenced from an '@_inlineable' function

and I don't know the rules. @slavapestov @swiftix HALP!

@swiftix
Copy link
Contributor Author

swiftix commented Mar 18, 2017

@dabrahams An @_inlineable function can only reference:

  • public functions
  • @_inlineable functions
  • @_versioned functions.

So, in your case you most likely want to add @_versioned to your internal method.

If you think that it makes sense to make this internal method also potentially available for inlining (i.e. you want to serialize its SIL body), you can also add @_inlineable in addition to @_versioned.

@dabrahams
Copy link
Collaborator

@swiftix Thanks; I think I got past the errors eventually. Not sure I did it "right", but the merge is 435a67a if you want to look.

@swiftix
Copy link
Contributor Author

swiftix commented Mar 20, 2017

@palimondo Yeah, Filter was probably overlooked. PRs are welcome ;-)

@palimondo
Copy link
Collaborator

@swiftix I’d love to, but I can not get the swift-source to compile on my machine… any pointers to where I might get help?

@swiftix
Copy link
Contributor Author

swiftix commented Mar 20, 2017

@palimondo You could ask questions on the swift-dev@swift.org mailing list.

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.

None yet

6 participants