Skip to content

Change unicodescalar initializer to failable #3662

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
Jul 26, 2016
Merged

Change unicodescalar initializer to failable #3662

merged 1 commit into from
Jul 26, 2016

Conversation

trentxintong
Copy link
Contributor

No description provided.

@trentxintong
Copy link
Contributor Author

@swift-ci Please smoke test

@trentxintong trentxintong added the swift evolution pending discussion Flag → feature: A feature that has a Swift evolution proposal currently in review label Jul 21, 2016
@@ -69,13 +69,14 @@ public struct UnicodeScalar :
///
/// let codepoint: UInt32 = 127881
/// let emoji = UnicodeScalar(codepoint)
/// print(emoji)
/// print(emoji!)
/// // Prints "🎉"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also add an example of when it can return nil?

@trentxintong
Copy link
Contributor Author

@gribozavr I am not completely done with this. But you can continue taking a look. I will address what you put here.

public init(_ v: UInt16) {
self = UnicodeScalar(UInt32(v))
/// `0xE000...0x10FFFF`. In case of a invalid unicode scalar value, nil is
/// return'ed.
Copy link
Contributor

Choose a reason for hiding this comment

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

'returned'

@gribozavr
Copy link
Contributor

@trentxintong Thank you! Could you ping me when you are ready?

@trentxintong
Copy link
Contributor Author

@gribozavr Thanks for the review. I will ping you after addressing the suggestions.

@trentxintong
Copy link
Contributor Author

@swift-ci Please benchmark

@trentxintong
Copy link
Contributor Author

@gribozavr Can you please take a look again ?

@trentxintong
Copy link
Contributor Author

@swift-ci Please smoke test

@@ -339,7 +339,7 @@ public struct _StringCore {
start: UnsafeMutablePointer<UTF8.CodeUnit>(_baseAddress!),
count: count
) {
Encoding.encode(UnicodeScalar(UInt32(x)), into: processCodeUnit)
Encoding.encode(UnicodeScalar(UInt32(x))!, into: processCodeUnit)
Copy link
Contributor

@gribozavr gribozavr Jul 21, 2016

Choose a reason for hiding this comment

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

I think this line can be:

Encoding.encode(UnicodeScalar(x), into: processCodeUnit)

because x is a UInt8.

@gribozavr
Copy link
Contributor

gribozavr commented Jul 21, 2016

@trentxintong Just a few stylistic comments. Could you also add tests for returning nil in validation-test/stdlib/Unicode.swift.gyb in the following section?

UnicodeScalarTests.test("init") {
  expectEqual("f", UnicodeScalar(102))
  expectEqual("g", UnicodeScalar(UInt32(103)))
  expectEqual("h", UnicodeScalar(UInt16(104)))
  expectEqual("i", UnicodeScalar(UInt8(105)))
}

LGTM with that.

@swift-ci
Copy link
Contributor

Build comment file:

Optimized (O)

Regression (4)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
DictionaryBridge 5815 9557 +64.3% 0.61x(?)
Calculator 30 33 +10.0% 0.91x
StaticArray 2687 2850 +6.1% 0.94x(?)
ObjectiveCBridgeToNSDictionary 20778 22121 +6.5% 0.94x(?)

Improvement (5)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
Array2D 2035 1917 -5.8% 1.06x(?)
ObjectiveCBridgeStubFromNSString 691 649 -6.1% 1.06x
StringEqualPointerComparison 7874 7267 -7.7% 1.08x(?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 148052 136152 -8.0% 1.09x
MapReduce 447 400 -10.5% 1.12x(?)

No Changes (125)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
NSStringConversion 613 583 -4.9% 1.05x
ObjectiveCBridgeFromNSArrayAnyObjectToString 116001 111436 -3.9% 1.04x(?)
ObjectiveCBridgeFromNSSetAnyObject 172784 165365 -4.3% 1.04x
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 123735 118786 -4.0% 1.04x(?)
ObjectiveCBridgeFromNSStringForced 2285 2215 -3.1% 1.03x(?)
ObjectiveCBridgeStubToNSDate 13322 12943 -2.8% 1.03x(?)
Integrate 243 236 -2.9% 1.03x(?)
PopFrontUnsafePointer 9009 8762 -2.7% 1.03x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 165234 161135 -2.5% 1.03x
DictionaryRemove 5157 5029 -2.5% 1.03x(?)
ObjectiveCBridgeToNSString 1068 1044 -2.2% 1.02x
Prims 761 747 -1.8% 1.02x(?)
StringInterpolation 11448 11209 -2.1% 1.02x(?)
Walsh 313 307 -1.9% 1.02x(?)
ObjectiveCBridgeStubURLAppendPathRef 246281 241450 -2.0% 1.02x(?)
OpenClose 51 50 -2.0% 1.02x
ObjectiveCBridgeFromNSArrayAnyObject 72090 70722 -1.9% 1.02x(?)
SetIntersect 1169 1149 -1.7% 1.02x(?)
NSDictionaryCastToSwift 14103 13883 -1.6% 1.02x(?)
DeadArray 182 178 -2.2% 1.02x
ArraySubscript 1378 1365 -0.9% 1.01x(?)
StackPromo 19296 19098 -1.0% 1.01x
PopFrontArray 1144 1134 -0.9% 1.01x(?)
Histogram 659 654 -0.8% 1.01x(?)
SortStrings 1741 1723 -1.0% 1.01x(?)
DictionarySwapOfObjects 6742 6670 -1.1% 1.01x(?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 5241 5179 -1.2% 1.01x(?)
Dictionary3OfObjects 881 873 -0.9% 1.01x(?)
StrComplexWalk 2985 2959 -0.9% 1.01x(?)
SuperChars 351000 348272 -0.8% 1.01x(?)
StringHasSuffix 669 664 -0.8% 1.01x(?)
Join 453 450 -0.7% 1.01x
ProtocolDispatch2 161 159 -1.2% 1.01x(?)
Dictionary3 532 529 -0.6% 1.01x
ArrayOfRef 3505 3484 -0.6% 1.01x(?)
PopFrontArrayGeneric 1159 1149 -0.9% 1.01x(?)
CaptureProp 4153 4129 -0.6% 1.01x(?)
ObjectiveCBridgeStubToNSStringRef 119 118 -0.8% 1.01x
DictionaryLiteral 4291 4261 -0.7% 1.01x(?)
Hanoi 3289 3244 -1.4% 1.01x
ObjectiveCBridgeStubURLAppendPath 250104 247050 -1.2% 1.01x(?)
Dictionary 735 725 -1.4% 1.01x
ArrayInClass 85 84 -1.2% 1.01x(?)
ArrayOfGenericRef 3569 3523 -1.3% 1.01x
Phonebook 6939 6897 -0.6% 1.01x(?)
MonteCarloE 10028 9976 -0.5% 1.01x
StringHasPrefixUnicode 15649 15539 -0.7% 1.01x(?)
MonteCarloPi 42539 42525 -0.0% 1.00x(?)
RecursiveOwnedParameter 1828 1830 +0.1% 1.00x(?)
ClassArrayGetter 12 12 +0.0% 1.00x
StringWithCString 78389 78541 +0.2% 1.00x(?)
SortLettersInPlace 962 959 -0.3% 1.00x(?)
DictionarySwap 746 745 -0.1% 1.00x(?)
ByteSwap 1 1 +0.0% 1.00x
XorLoop 361 360 -0.3% 1.00x
ProtocolDispatch 2967 2956 -0.4% 1.00x(?)
TypeFlood 0 0 +0.0% 1.00x
ArrayLiteral 1012 1012 +0.0% 1.00x
Dictionary2 1911 1913 +0.1% 1.00x(?)
SetIntersect_OfObjects 2306 2309 +0.1% 1.00x(?)
ObjectiveCBridgeStubDateMutation 265 266 +0.4% 1.00x(?)
ObjectiveCBridgeToNSArray 31598 31485 -0.4% 1.00x(?)
NSError 324 323 -0.3% 1.00x
DictionaryOfObjects 2233 2229 -0.2% 1.00x(?)
ObjectiveCBridgeStubToNSDateRef 3294 3288 -0.2% 1.00x(?)
ArrayOfGenericPOD 208 208 +0.0% 1.00x
SortStringsUnicode 9382 9422 +0.4% 1.00x(?)
SetIsSubsetOf 480 479 -0.2% 1.00x
NopDeinit 35334 35421 +0.2% 1.00x(?)
ObjectiveCBridgeStubDataAppend 2849 2837 -0.4% 1.00x(?)
RGBHistogramOfObjects 21725 21756 +0.1% 1.00x(?)
StringBuilder 1520 1519 -0.1% 1.00x(?)
SetExclusiveOr_OfObjects 8343 8312 -0.4% 1.00x(?)
StringHasSuffixUnicode 64145 64257 +0.2% 1.00x(?)
HashTest 2007 2008 +0.1% 1.00x(?)
SetIsSubsetOf_OfObjects 616 615 -0.2% 1.00x(?)
ObjectiveCBridgeToNSSet 19308 19315 +0.0% 1.00x(?)
LinkedList 6804 6805 +0.0% 1.00x(?)
RGBHistogram 3101 3097 -0.1% 1.00x(?)
ArrayAppendReserved 516 518 +0.4% 1.00x(?)
ArrayOfPOD 172 172 +0.0% 1.00x
SetUnion 3374 3365 -0.3% 1.00x(?)
StrToInt 4948 4930 -0.4% 1.00x(?)
BitCount 1 1 +0.0% 1.00x
AngryPhonebook 2854 2865 +0.4% 1.00x(?)
ArrayValueProp3 5 5 +0.0% 1.00x
ArrayValueProp 5 5 +0.0% 1.00x
ObjectiveCBridgeStubFromArrayOfNSString 81168 81310 +0.2% 1.00x(?)
GlobalClass 0 0 +0.0% 1.00x
Memset 222 222 +0.0% 1.00x
Dictionary2OfObjects 3314 3319 +0.1% 1.00x(?)
ArrayValueProp4 5 5 +0.0% 1.00x
ArrayValueProp2 5 5 +0.0% 1.00x
SevenBoom 1321 1315 -0.5% 1.00x(?)
ObjectiveCBridgeStubFromNSDate 3443 3452 +0.3% 1.00x(?)
ArrayAppend 740 744 +0.5% 0.99x(?)
RC4 251 253 +0.8% 0.99x
DictionaryRemoveOfObjects 19818 20010 +1.0% 0.99x(?)
UTF8Decode 318 321 +0.9% 0.99x(?)
ObjectiveCBridgeStubToArrayOfNSString 30312 30691 +1.2% 0.99x(?)
SetExclusiveOr 3693 3722 +0.8% 0.99x(?)
ObjectiveCBridgeStubNSDateRefAccess 305 307 +0.7% 0.99x(?)
ObjectiveCBridgeFromNSString 1615 1626 +0.7% 0.99x(?)
ObjectiveCBridgeStubDateAccess 177 178 +0.6% 0.99x(?)
Sim2DArray 385 390 +1.3% 0.99x(?)
SetUnion_OfObjects 7004 7061 +0.8% 0.99x(?)
ObjectiveCBridgeFromNSSetAnyObjectToString 201480 203510 +1.0% 0.99x(?)
ObjectiveCBridgeFromNSSetAnyObjectForced 4027 4086 +1.5% 0.99x(?)
StringWalk 5555 5602 +0.8% 0.99x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 260334 265411 +1.9% 0.98x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 6032 6133 +1.7% 0.98x(?)
ObjectiveCBridgeFromNSDictionaryAnyObject 359566 367984 +2.3% 0.98x(?)
ObjectAllocation 146 149 +2.0% 0.98x(?)
StringHasPrefix 621 636 +2.4% 0.98x(?)
ErrorHandling 3038 3092 +1.8% 0.98x
PolymorphicCalls 61 62 +1.6% 0.98x(?)
Chars 631 641 +1.6% 0.98x
ObjectiveCBridgeStubNSDateMutationRef 11630 11918 +2.5% 0.98x(?)
TwoSum 1918 1957 +2.0% 0.98x
ObjectiveCBridgeStubFromNSDateRef 3649 3758 +3.0% 0.97x(?)
RangeAssignment 311 320 +2.9% 0.97x(?)
ObjectiveCBridgeStubNSDataAppend 2338 2421 +3.5% 0.97x(?)
133 3434391 3573532 +4.0% 0.96x
ObjectiveCBridgeStubToNSString 1224 1284 +4.9% 0.95x
ObjectiveCBridgeStubFromNSStringRef 127 133 +4.7% 0.95x(?)
**Unoptimized (Onone)**

Regression (8)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
ObjectiveCBridgeStubFromNSStringRef 160 193 +20.6% 0.83x
ObjectiveCBridgeStubDateMutation 440 515 +17.1% 0.85x(?)
StringWalk 20864 23133 +10.9% 0.90x(?)
ObjectiveCBridgeStubDateAccess 1110 1226 +10.4% 0.91x(?)
OpenClose 446 479 +7.4% 0.93x(?)
NopDeinit 56205 60564 +7.8% 0.93x(?)
StringHasSuffix 1520 1610 +5.9% 0.94x(?)
ObjectiveCBridgeToNSDictionary 20423 21637 +5.9% 0.94x

Improvement (5)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
ArrayOfGenericPOD 3625 3407 -6.0% 1.06x
ArrayOfPOD 2396 2262 -5.6% 1.06x
ProtocolDispatch 5852 5441 -7.0% 1.08x
PolymorphicCalls 1266 1171 -7.5% 1.08x
Calculator 977 881 -9.8% 1.11x

No Changes (121)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
DictionarySwapOfObjects 64065 61815 -3.5% 1.04x(?)
PopFrontArray 29951 28927 -3.4% 1.04x
ObjectiveCBridgeStubFromNSDate 3848 3689 -4.1% 1.04x(?)
ObjectiveCBridgeStubFromNSDateRef 4130 3993 -3.3% 1.03x
ObjectiveCBridgeFromNSStringForced 2766 2691 -2.7% 1.03x(?)
StringInterpolation 16020 15617 -2.5% 1.03x
ObjectiveCBridgeStubURLAppendPathRef 252993 246100 -2.7% 1.03x(?)
SetExclusiveOr 162824 158498 -2.7% 1.03x
RangeAssignment 44472 43754 -1.6% 1.02x(?)
ObjectiveCBridgeStubFromNSString 700 683 -2.4% 1.02x(?)
StaticArray 28014 27465 -2.0% 1.02x(?)
ObjectiveCBridgeStubToNSDateRef 3207 3150 -1.8% 1.02x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 168464 165159 -2.0% 1.02x(?)
ObjectiveCBridgeStubDataAppend 3302 3248 -1.6% 1.02x(?)
SetIsSubsetOf_OfObjects 5860 5765 -1.6% 1.02x(?)
ArrayValueProp4 2727 2673 -2.0% 1.02x
DeadArray 131392 128716 -2.0% 1.02x(?)
ArraySubscript 7334 7275 -0.8% 1.01x(?)
ObjectiveCBridgeToNSString 1108 1094 -1.3% 1.01x(?)
StackPromo 146729 144782 -1.3% 1.01x(?)
SortStrings 2599 2572 -1.0% 1.01x
DictionaryBridge 4993 4935 -1.2% 1.01x(?)
SortLettersInPlace 2642 2617 -0.9% 1.01x(?)
StringHasPrefix 1576 1563 -0.8% 1.01x(?)
ArrayLiteral 1085 1073 -1.1% 1.01x(?)
Dictionary2 9304 9217 -0.9% 1.01x(?)
StrComplexWalk 7965 7914 -0.6% 1.01x(?)
ArrayOfRef 10369 10284 -0.8% 1.01x(?)
ObjectiveCBridgeToNSSet 19686 19559 -0.7% 1.01x(?)
ObjectiveCBridgeStubToNSStringRef 156 154 -1.3% 1.01x(?)
DictionaryLiteral 32380 31946 -1.3% 1.01x(?)
ObjectiveCBridgeStubToArrayOfNSString 30767 30604 -0.5% 1.01x(?)
SetIntersect 54653 53975 -1.2% 1.01x(?)
ObjectiveCBridgeStubNSDateRefAccess 1245 1233 -1.0% 1.01x(?)
ArrayInClass 3698 3660 -1.0% 1.01x
RGBHistogram 116971 115769 -1.0% 1.01x(?)
StrToInt 5567 5493 -1.3% 1.01x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 120982 119989 -0.8% 1.01x(?)
MonteCarloPi 50988 50742 -0.5% 1.00x(?)
RecursiveOwnedParameter 18375 18445 +0.4% 1.00x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 276852 275489 -0.5% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 117692 117402 -0.2% 1.00x(?)
ClassArrayGetter 2103 2102 -0.1% 1.00x(?)
Array2D 1159317 1154555 -0.4% 1.00x(?)
Histogram 33668 33535 -0.4% 1.00x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 9638 9653 +0.2% 1.00x(?)
StringWithCString 191842 191577 -0.1% 1.00x(?)
133 7932679 7928046 -0.1% 1.00x
Dictionary3OfObjects 5642 5642 +0.0% 1.00x
ByteSwap 10 10 +0.0% 1.00x
SuperChars 514103 513971 -0.0% 1.00x(?)
XorLoop 18578 18562 -0.1% 1.00x(?)
TypeFlood 149 149 +0.0% 1.00x
HashTest 5485 5507 +0.4% 1.00x(?)
Dictionary3 4856 4873 +0.3% 1.00x(?)
SetIntersect_OfObjects 49428 49547 +0.2% 1.00x(?)
Join 1814 1807 -0.4% 1.00x(?)
PopFrontArrayGeneric 12250 12265 +0.1% 1.00x(?)
PopFrontUnsafePointer 245408 244614 -0.3% 1.00x(?)
MapReduce 61667 61667 +0.0% 1.00x
Hanoi 19512 19497 -0.1% 1.00x(?)
DictionaryRemoveOfObjects 176970 177110 +0.1% 1.00x(?)
UTF8Decode 57878 58112 +0.4% 1.00x(?)
ObjectiveCBridgeStubURLAppendPath 246807 247758 +0.4% 1.00x(?)
ObjectiveCBridgeFromNSArrayAnyObject 75996 76021 +0.0% 1.00x(?)
RGBHistogramOfObjects 167785 167114 -0.4% 1.00x(?)
GlobalClass 0 0 +0.0% 1.00x
StringBuilder 2829 2841 +0.4% 1.00x(?)
ArrayOfGenericRef 11041 11056 +0.1% 1.00x(?)
Sim2DArray 14159 14096 -0.4% 1.00x(?)
MonteCarloE 141232 141118 -0.1% 1.00x(?)
SetUnion_OfObjects 137361 137108 -0.2% 1.00x(?)
StringHasSuffixUnicode 65731 65583 -0.2% 1.00x(?)
Walsh 12354 12369 +0.1% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectForced 8821 8813 -0.1% 1.00x(?)
SetUnion 118654 118305 -0.3% 1.00x(?)
AngryPhonebook 3663 3678 +0.4% 1.00x(?)
ObjectiveCBridgeStubFromArrayOfNSString 80135 80410 +0.3% 1.00x(?)
RC4 8583 8590 +0.1% 1.00x(?)
Memset 19799 19709 -0.5% 1.00x(?)
Dictionary2OfObjects 11159 11187 +0.2% 1.00x(?)
TwoSum 26973 27075 +0.4% 1.00x(?)
ObjectiveCBridgeStubNSDataAppend 5106 5112 +0.1% 1.00x(?)
Integrate 359 364 +1.4% 0.99x(?)
Prims 34434 34665 +0.7% 0.99x(?)
DictionarySwap 46645 47127 +1.0% 0.99x(?)
ObjectiveCBridgeStubToNSString 1300 1317 +1.3% 0.99x(?)
ObjectAllocation 535 540 +0.9% 0.99x(?)
ObjectiveCBridgeToNSArray 32021 32456 +1.4% 0.99x(?)
NSError 682 687 +0.7% 0.99x(?)
StringEqualPointerComparison 9719 9840 +1.2% 0.99x(?)
SortStringsUnicode 10345 10421 +0.7% 0.99x(?)
SetIsSubsetOf 6322 6360 +0.6% 0.99x(?)
Dictionary 7312 7352 +0.6% 0.99x(?)
ObjectiveCBridgeFromNSString 4780 4843 +1.3% 0.99x(?)
SetExclusiveOr_OfObjects 180250 181688 +0.8% 0.99x
StringHasPrefixUnicode 17130 17227 +0.6% 0.99x(?)
LinkedList 26163 26527 +1.4% 0.99x
ObjectiveCBridgeFromNSSetAnyObjectToString 211725 213588 +0.9% 0.99x(?)
NSStringConversion 2672 2708 +1.4% 0.99x(?)
Chars 5295 5342 +0.9% 0.99x(?)
ArrayValueProp2 2776 2805 +1.0% 0.99x(?)
ArrayValueProp 2259 2292 +1.5% 0.99x(?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 8780 8974 +2.2% 0.98x(?)
ObjectiveCBridgeStubToNSDate 13534 13754 +1.6% 0.98x(?)
ErrorHandling 3988 4078 +2.3% 0.98x(?)
ProtocolDispatch2 451 460 +2.0% 0.98x
DictionaryOfObjects 10258 10481 +2.2% 0.98x(?)
CaptureProp 119906 122159 +1.9% 0.98x(?)
NSDictionaryCastToSwift 15913 16276 +2.3% 0.98x
Phonebook 63511 65097 +2.5% 0.98x(?)
DictionaryRemove 135903 138120 +1.6% 0.98x(?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 151228 154403 +2.1% 0.98x(?)
SevenBoom 1468 1491 +1.6% 0.98x(?)
ObjectiveCBridgeFromNSDictionaryAnyObject 365947 378088 +3.3% 0.97x(?)
ObjectiveCBridgeFromNSSetAnyObject 172350 178369 +3.5% 0.97x(?)
ObjectiveCBridgeStubNSDateMutationRef 14090 14551 +3.3% 0.97x(?)
ArrayValueProp3 2679 2761 +3.1% 0.97x
ArrayAppend 3451 3595 +4.2% 0.96x(?)
BitCount 92 96 +4.3% 0.96x(?)
ArrayAppendReserved 3227 3398 +5.3% 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

@trentxintong
Copy link
Contributor Author

@swift-ci Please benchmark

We were using a precondition which crashes the program when invalid input is
provided. We want to provide a way to gracefully check and handle invalid input
or shutdown the program if necessary.

SR-1930
@trentxintong
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build comment file:

Optimized (O)

Regression (2)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
DictionaryLiteral 4319 4762 +10.3% 0.91x
NSDictionaryCastToSwift 14373 15323 +6.6% 0.94x

Improvement (1)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
ClassArrayGetter 14 12 -14.3% 1.17x

No Changes (131)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
StaticArray 2863 2775 -3.1% 1.03x(?)
ObjectiveCBridgeStubURLAppendPath 233814 226488 -3.1% 1.03x
ObjectiveCBridgeFromNSArrayAnyObjectForced 5467 5339 -2.3% 1.02x(?)
ObjectiveCBridgeToNSArray 32603 31883 -2.2% 1.02x(?)
ObjectiveCBridgeStubToNSDateRef 3478 3395 -2.4% 1.02x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 164872 161750 -1.9% 1.02x(?)
ObjectiveCBridgeFromNSArrayAnyObject 75036 73356 -2.2% 1.02x(?)
StrToInt 5109 5021 -1.7% 1.02x
ArraySubscript 1434 1422 -0.8% 1.01x(?)
ObjectiveCBridgeToNSString 1078 1071 -0.7% 1.01x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 118333 117627 -0.6% 1.01x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 6195 6124 -1.1% 1.01x(?)
SortLettersInPlace 1007 1001 -0.6% 1.01x
ArrayOfRef 3594 3566 -0.8% 1.01x(?)
ObjectiveCBridgeStubURLAppendPathRef 230454 227378 -1.3% 1.01x(?)
SetExclusiveOr 3865 3842 -0.6% 1.01x(?)
ArrayOfGenericRef 3647 3620 -0.7% 1.01x(?)
ObjectiveCBridgeToNSDictionary 21896 21711 -0.8% 1.01x(?)
SetUnion 3472 3454 -0.5% 1.01x(?)
133 3309678 3288664 -0.6% 1.01x
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 121315 120652 -0.6% 1.01x(?)
Dictionary2OfObjects 3417 3377 -1.2% 1.01x(?)
DictionarySwapOfObjects 6856 6873 +0.2% 1.00x(?)
StackPromo 20162 20164 +0.0% 1.00x(?)
RecursiveOwnedParameter 1936 1934 -0.1% 1.00x(?)
ObjectiveCBridgeStubToNSString 1296 1298 +0.1% 1.00x
Array2D 2049 2054 +0.2% 1.00x(?)
Histogram 677 677 +0.0% 1.00x
SortStrings 2299 2305 +0.3% 1.00x
ObjectiveCBridgeStubFromNSDateRef 3743 3740 -0.1% 1.00x(?)
MonteCarloPi 44956 44954 -0.0% 1.00x(?)
StringWithCString 81795 81853 +0.1% 1.00x(?)
ObjectiveCBridgeFromNSStringForced 2278 2278 +0.0% 1.00x
Prims 777 775 -0.3% 1.00x(?)
DictionarySwap 762 761 -0.1% 1.00x
ObjectiveCBridgeFromNSString 1594 1595 +0.1% 1.00x(?)
PopFrontArray 1155 1155 +0.0% 1.00x
ArrayOfGenericPOD 220 220 +0.0% 1.00x
Dictionary3OfObjects 907 909 +0.2% 1.00x(?)
RangeAssignment 318 317 -0.3% 1.00x(?)
StringHasPrefix 688 689 +0.1% 1.00x(?)
ByteSwap 1 1 +0.0% 1.00x
SuperChars 366511 365328 -0.3% 1.00x(?)
XorLoop 381 381 +0.0% 1.00x
StringInterpolation 11856 11819 -0.3% 1.00x(?)
Integrate 238 238 +0.0% 1.00x
ErrorHandling 3062 3057 -0.2% 1.00x(?)
ProtocolDispatch 3040 3039 -0.0% 1.00x(?)
TypeFlood 0 0 +0.0% 1.00x
ObjectiveCBridgeFromNSSetAnyObject 169421 169266 -0.1% 1.00x(?)
AngryPhonebook 2852 2838 -0.5% 1.00x(?)
ProtocolDispatch2 158 158 +0.0% 1.00x
HashTest 2066 2070 +0.2% 1.00x(?)
Dictionary3 553 553 +0.0% 1.00x
Dictionary2 1970 1964 -0.3% 1.00x(?)
StrComplexWalk 3131 3118 -0.4% 1.00x(?)
SetIntersect_OfObjects 2435 2442 +0.3% 1.00x(?)
Join 466 466 +0.0% 1.00x
ObjectiveCBridgeStubDateMutation 273 273 +0.0% 1.00x
NSError 336 337 +0.3% 1.00x(?)
DictionaryOfObjects 2297 2289 -0.3% 1.00x(?)
PopFrontArrayGeneric 1151 1152 +0.1% 1.00x(?)
PopFrontUnsafePointer 9397 9392 -0.1% 1.00x(?)
StringEqualPointerComparison 7326 7315 -0.1% 1.00x(?)
CaptureProp 4195 4195 +0.0% 1.00x
PolymorphicCalls 63 63 +0.0% 1.00x
RC4 265 264 -0.4% 1.00x
ObjectiveCBridgeStubToNSStringRef 125 125 +0.0% 1.00x
Calculator 33 33 +0.0% 1.00x
MapReduce 373 373 +0.0% 1.00x
Hanoi 3409 3398 -0.3% 1.00x(?)
OpenClose 54 54 +0.0% 1.00x
DictionaryRemoveOfObjects 20574 20586 +0.1% 1.00x(?)
UTF8Decode 330 330 +0.0% 1.00x
SortStringsUnicode 10072 10096 +0.2% 1.00x
SetIsSubsetOf 508 508 +0.0% 1.00x
NopDeinit 36668 36670 +0.0% 1.00x(?)
ObjectiveCBridgeStubToArrayOfNSString 31409 31442 +0.1% 1.00x(?)
SetIntersect 1199 1201 +0.2% 1.00x(?)
ObjectiveCBridgeStubDataAppend 2886 2898 +0.4% 1.00x(?)
ObjectiveCBridgeStubNSDateRefAccess 338 338 +0.0% 1.00x
StringBuilder 1587 1589 +0.1% 1.00x
ArrayInClass 86 86 +0.0% 1.00x
StringHasSuffix 710 710 +0.0% 1.00x
Phonebook 7191 7172 -0.3% 1.00x
ObjectiveCBridgeStubDateAccess 182 182 +0.0% 1.00x
Sim2DArray 429 429 +0.0% 1.00x
SetExclusiveOr_OfObjects 8756 8775 +0.2% 1.00x
MonteCarloE 10565 10561 -0.0% 1.00x(?)
Walsh 318 317 -0.3% 1.00x
SetIsSubsetOf_OfObjects 652 652 +0.0% 1.00x
ArrayAppend 773 773 +0.0% 1.00x
DictionaryRemove 5185 5163 -0.4% 1.00x(?)
LinkedList 7203 7203 +0.0% 1.00x
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 141204 140707 -0.3% 1.00x(?)
RGBHistogramOfObjects 22807 22835 +0.1% 1.00x(?)
RGBHistogram 3149 3162 +0.4% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectForced 4176 4166 -0.2% 1.00x(?)
ArrayValueProp4 6 6 +0.0% 1.00x
ArrayOfPOD 182 182 +0.0% 1.00x
Chars 657 657 +0.0% 1.00x
DeadArray 182 182 +0.0% 1.00x
ArrayValueProp2 6 6 +0.0% 1.00x
BitCount 1 1 +0.0% 1.00x
ArrayLiteral 1025 1024 -0.1% 1.00x(?)
SevenBoom 1360 1355 -0.4% 1.00x(?)
StringWalk 5870 5870 +0.0% 1.00x
ArrayValueProp 6 6 +0.0% 1.00x
ObjectiveCBridgeStubFromArrayOfNSString 81867 82273 +0.5% 1.00x(?)
ObjectiveCBridgeStubNSDateMutationRef 12391 12384 -0.1% 1.00x(?)
GlobalClass 0 0 +0.0% 1.00x
Memset 235 236 +0.4% 1.00x
ArrayAppendReserved 536 536 +0.0% 1.00x
ArrayValueProp3 6 6 +0.0% 1.00x
ObjectiveCBridgeStubFromNSDate 3564 3560 -0.1% 1.00x
ObjectiveCBridgeFromNSDictionaryAnyObject 362767 368112 +1.5% 0.99x
DictionaryBridge 7180 7288 +1.5% 0.99x(?)
ObjectiveCBridgeStubFromNSStringRef 132 133 +0.8% 0.99x(?)
ObjectiveCBridgeToNSSet 19288 19510 +1.1% 0.99x(?)
Dictionary 757 762 +0.7% 0.99x
ObjectiveCBridgeFromNSSetAnyObjectToString 200155 201943 +0.9% 0.99x(?)
SetUnion_OfObjects 7402 7448 +0.6% 0.99x
StringHasSuffixUnicode 65197 65759 +0.9% 0.99x
StringHasPrefixUnicode 15937 16067 +0.8% 0.99x
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 264441 270136 +2.1% 0.98x(?)
ObjectiveCBridgeStubToNSDate 13701 14006 +2.2% 0.98x
NSStringConversion 588 601 +2.2% 0.98x(?)
TwoSum 1981 2020 +2.0% 0.98x(?)
ObjectiveCBridgeStubFromNSString 676 696 +3.0% 0.97x
ObjectAllocation 151 155 +2.6% 0.97x
ObjectiveCBridgeStubNSDataAppend 2345 2406 +2.6% 0.97x(?)
**Unoptimized (Onone)**

Regression (7)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
StrComplexWalk 8109 8883 +9.5% 0.91x
StringHasPrefix 1582 1708 +8.0% 0.93x
NopDeinit 56717 61267 +8.0% 0.93x
ArrayAppend 3430 3682 +7.3% 0.93x
ArrayAppendReserved 3181 3427 +7.7% 0.93x
PopFrontUnsafePointer 250256 267193 +6.8% 0.94x
BitCount 91 97 +6.6% 0.94x

Improvement (4)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
ProtocolDispatch 5811 5472 -5.8% 1.06x
Calculator 1022 920 -10.0% 1.11x
StringWalk 28511 22111 -22.4% 1.29x
DictionaryBridge 9063 5114 -43.6% 1.77x(?)

No Changes (123)

TEST OLD_MIN NEW_MIN DELTA (%) SPEEDUP
PopFrontArray 31769 30147 -5.1% 1.05x
ObjectiveCBridgeFromNSArrayAnyObjectForced 9227 8903 -3.5% 1.04x(?)
TypeFlood 166 161 -3.0% 1.03x(?)
ProtocolDispatch2 457 444 -2.8% 1.03x
ObjectiveCBridgeStubDateAccess 1129 1095 -3.0% 1.03x
ArrayOfPOD 2453 2371 -3.3% 1.03x
ObjectiveCBridgeFromNSArrayAnyObjectToString 121277 118552 -2.2% 1.02x
ObjectiveCBridgeFromNSDictionaryAnyObject 380387 374716 -1.5% 1.02x(?)
ArrayOfGenericPOD 3526 3450 -2.2% 1.02x
StaticArray 27765 27227 -1.9% 1.02x(?)
ObjectiveCBridgeToNSArray 32902 32282 -1.9% 1.02x
NSError 702 685 -2.4% 1.02x
ObjectiveCBridgeToNSDictionary 22413 21872 -2.4% 1.02x(?)
StringBuilder 2973 2922 -1.7% 1.02x(?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 123653 120738 -2.4% 1.02x(?)
ObjectiveCBridgeStubFromArrayOfNSString 84951 83397 -1.8% 1.02x(?)
StackPromo 147202 146341 -0.6% 1.01x(?)
SortStrings 2726 2696 -1.1% 1.01x
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 9696 9578 -1.2% 1.01x(?)
DictionarySwapOfObjects 65010 64259 -1.2% 1.01x(?)
SortLettersInPlace 2710 2691 -0.7% 1.01x
ObjectiveCBridgeStubToNSDate 13813 13621 -1.4% 1.01x(?)
Integrate 365 363 -0.6% 1.01x(?)
ErrorHandling 3909 3871 -1.0% 1.01x(?)
ObjectAllocation 560 552 -1.4% 1.01x
Dictionary3 5037 5003 -0.7% 1.01x
CaptureProp 122563 121491 -0.9% 1.01x
Hanoi 20390 20116 -1.3% 1.01x
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 172050 170403 -1.0% 1.01x(?)
SetIsSubsetOf 6554 6508 -0.7% 1.01x(?)
StrToInt 5448 5408 -0.7% 1.01x
SetExclusiveOr_OfObjects 188063 186253 -1.0% 1.01x
DictionaryRemove 141244 139439 -1.3% 1.01x
DeadArray 134663 133290 -1.0% 1.01x(?)
ObjectiveCBridgeStubNSDataAppend 5388 5347 -0.8% 1.01x
ArraySubscript 7606 7623 +0.2% 1.00x(?)
ObjectiveCBridgeToNSString 1132 1133 +0.1% 1.00x(?)
MonteCarloPi 53597 53525 -0.1% 1.00x
RecursiveOwnedParameter 19357 19344 -0.1% 1.00x
ObjectiveCBridgeStubToNSString 1360 1358 -0.1% 1.00x(?)
ClassArrayGetter 2211 2208 -0.1% 1.00x(?)
Array2D 1211797 1206179 -0.5% 1.00x(?)
Histogram 34664 34674 +0.0% 1.00x(?)
ObjectiveCBridgeStubFromNSDateRef 4080 4080 +0.0% 1.00x
StringWithCString 202303 202567 +0.1% 1.00x
ObjectiveCBridgeFromNSStringForced 2696 2701 +0.2% 1.00x
Prims 35767 35621 -0.4% 1.00x(?)
DictionarySwap 47749 47578 -0.4% 1.00x(?)
Dictionary3OfObjects 5809 5802 -0.1% 1.00x(?)
ByteSwap 10 10 +0.0% 1.00x
SuperChars 538765 537348 -0.3% 1.00x(?)
XorLoop 19643 19647 +0.0% 1.00x(?)
ObjectiveCBridgeStubFromNSStringRef 168 168 +0.0% 1.00x
ObjectiveCBridgeFromNSSetAnyObject 180781 179921 -0.5% 1.00x(?)
ArrayLiteral 1111 1114 +0.3% 1.00x
HashTest 5698 5678 -0.3% 1.00x
Dictionary2 9623 9595 -0.3% 1.00x(?)
SetIntersect_OfObjects 51738 51689 -0.1% 1.00x(?)
Join 1891 1889 -0.1% 1.00x(?)
ArrayOfRef 10829 10796 -0.3% 1.00x
DictionaryOfObjects 10628 10668 +0.4% 1.00x(?)
PopFrontArrayGeneric 12672 12621 -0.4% 1.00x(?)
StringEqualPointerComparison 9724 9731 +0.1% 1.00x(?)
ObjectiveCBridgeStubToNSStringRef 164 164 +0.0% 1.00x
MapReduce 64469 64577 +0.2% 1.00x(?)
UTF8Decode 60977 61001 +0.0% 1.00x(?)
SortStringsUnicode 10342 10310 -0.3% 1.00x
Dictionary 7599 7620 +0.3% 1.00x(?)
ObjectiveCBridgeStubToArrayOfNSString 31372 31519 +0.5% 1.00x(?)
SetIntersect 56021 56223 +0.4% 1.00x(?)
ObjectiveCBridgeStubDataAppend 3238 3244 +0.2% 1.00x(?)
SetExclusiveOr 165117 164920 -0.1% 1.00x(?)
RGBHistogramOfObjects 173326 173326 +0.0% 1.00x
ObjectiveCBridgeStubNSDateRefAccess 1228 1231 +0.2% 1.00x
ArrayInClass 3865 3866 +0.0% 1.00x
ArrayOfGenericRef 11508 11470 -0.3% 1.00x(?)
Sim2DArray 14618 14624 +0.0% 1.00x(?)
MonteCarloE 147500 147203 -0.2% 1.00x(?)
GlobalClass 0 0 +0.0% 1.00x
Walsh 12868 12849 -0.1% 1.00x
SetIsSubsetOf_OfObjects 6102 6072 -0.5% 1.00x
ObjectiveCBridgeToNSSet 19802 19851 +0.2% 1.00x(?)
StringHasPrefixUnicode 17219 17170 -0.3% 1.00x
LinkedList 27612 27581 -0.1% 1.00x(?)
ObjectiveCBridgeFromNSSetAnyObjectToString 217518 217400 -0.1% 1.00x(?)
NSStringConversion 2768 2763 -0.2% 1.00x(?)
SetUnion 124396 124127 -0.2% 1.00x(?)
Chars 5344 5359 +0.3% 1.00x
AngryPhonebook 3775 3774 -0.0% 1.00x(?)
SevenBoom 1531 1525 -0.4% 1.00x
ArrayValueProp 2313 2316 +0.1% 1.00x(?)
ObjectiveCBridgeFromNSString 4900 4877 -0.5% 1.00x(?)
RC4 8993 8996 +0.0% 1.00x(?)
Memset 20656 20666 +0.1% 1.00x(?)
Dictionary2OfObjects 11410 11393 -0.1% 1.00x(?)
ArrayValueProp4 2714 2708 -0.2% 1.00x
TwoSum 28403 28323 -0.3% 1.00x(?)
ArrayValueProp2 2850 2844 -0.2% 1.00x(?)
ArrayValueProp3 2766 2771 +0.2% 1.00x(?)
133 7821170 7885987 +0.8% 0.99x
RangeAssignment 45609 46208 +1.3% 0.99x
StringHasSuffixUnicode 66675 67178 +0.8% 0.99x
ObjectiveCBridgeStubURLAppendPathRef 228884 231151 +1.0% 0.99x(?)
ObjectiveCBridgeStubToNSDateRef 3319 3343 +0.7% 0.99x(?)
DictionaryLiteral 33561 33845 +0.8% 0.99x(?)
OpenClose 457 462 +1.1% 0.99x(?)
DictionaryRemoveOfObjects 180862 183040 +1.2% 0.99x
ObjectiveCBridgeStubURLAppendPath 226737 228822 +0.9% 0.99x(?)
SetUnion_OfObjects 142062 143001 +0.7% 0.99x(?)
RGBHistogram 119833 121336 +1.2% 0.99x(?)
ObjectiveCBridgeFromNSSetAnyObjectForced 8788 8904 +1.3% 0.99x(?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 274275 279251 +1.8% 0.98x(?)
StringInterpolation 15940 16301 +2.3% 0.98x(?)
PolymorphicCalls 1169 1191 +1.9% 0.98x
NSDictionaryCastToSwift 16626 16964 +2.0% 0.98x(?)
Phonebook 62314 63396 +1.7% 0.98x(?)
ObjectiveCBridgeStubNSDateMutationRef 14719 15044 +2.2% 0.98x(?)
ObjectiveCBridgeStubFromNSDate 3683 3777 +2.5% 0.98x
ObjectiveCBridgeStubFromNSString 720 746 +3.6% 0.97x
ObjectiveCBridgeFromNSArrayAnyObject 76240 78981 +3.6% 0.97x(?)
StringHasSuffix 1611 1656 +2.8% 0.97x
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 150247 155813 +3.7% 0.96x(?)
ObjectiveCBridgeStubDateMutation 434 456 +5.1% 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

@trentxintong
Copy link
Contributor Author

@swift-ci Please test

1 similar comment
@trentxintong
Copy link
Contributor Author

@swift-ci Please test

@trentxintong
Copy link
Contributor Author

This is approved on swift-evolution. I am going to merge once finished with test sometime before end of today

@trentxintong
Copy link
Contributor Author

I am merging this and fix Linux build crash in another commit as it is to a different repository.

@trentxintong trentxintong merged commit 9709b0e into swiftlang:master Jul 26, 2016
@lattner
Copy link
Contributor

lattner commented Jul 27, 2016

Nice, please update the changelog!

@trentxintong trentxintong removed the swift evolution pending discussion Flag → feature: A feature that has a Swift evolution proposal currently in review label Jul 27, 2016
@trentxintong trentxintong deleted the unicodescalar branch August 10, 2016 05:13
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.

4 participants