Skip to content

[stdlib] Update Array.subscript to use _modify #19154

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 3 commits into from
Sep 7, 2018

Conversation

airspeedswift
Copy link
Member

This switches Array from using mutableAddressWithNativeOwner to using a yielding _modify

@airspeedswift
Copy link
Member Author

@swift-ci please smoke benchmark

@airspeedswift
Copy link
Member Author

@swift-ci please test

@airspeedswift
Copy link
Member Author

@swift-ci please smoke test compiler performance

@airspeedswift
Copy link
Member Author

@swift-ci please test source compatibility

@swift-ci
Copy link
Contributor

swift-ci commented Sep 6, 2018

Build failed
Swift Test OS X Platform
Git Sha - 621441664b406749bae7b5fc790e74ddb3b3c3ba

@swift-ci
Copy link
Contributor

swift-ci commented Sep 6, 2018

Build failed
Swift Test Linux Platform
Git Sha - 621441664b406749bae7b5fc790e74ddb3b3c3ba

@airspeedswift
Copy link
Member Author

I guess that'll teach me for skipping building the benchmarks 😞

@@ -646,31 +647,6 @@ extension Array {
return _buffer.capacity
}

/// - Precondition: The array has a native buffer.
@inlinable
@_semantics("array.owner")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove optimizer code that checks for this semantics attribute also?

palomino:swift spestov$ git grep kGetArrayOwner
include/swift/SILOptimizer/Analysis/ArraySemantic.h:  kGetArrayOwner,
lib/SILOptimizer/Analysis/ArraySemantic.cpp:            .Case("array.owner", ArrayCallKind::kGetArrayOwner)
lib/SILOptimizer/Analysis/EscapeAnalysis.cpp:      case ArrayCallKind::kGetArrayOwner:
lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp:  case ArrayCallKind::kGetArrayOwner:
lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp:  case ArrayCallKind::kGetArrayOwner:

Copy link
Member Author

Choose a reason for hiding this comment

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

It's still there in ContiguousArray and ArraySlice, which are next up.

@swift-ci
Copy link
Contributor

swift-ci commented Sep 6, 2018

Build comment file:

Performance: -O

TEST OLD NEW DELTA SPEEDUP
Regression
Memset 215 3150 +1365.1% 0.07x
Sim2DArray 311 2198 +606.8% 0.14x
XorLoop 400 1905 +376.2% 0.21x
ArrayInClass 87 347 +298.8% 0.25x
RemoveWhereSwapInts 20 65 +225.0% 0.31x
RC4 155 495 +219.4% 0.31x
Walsh 403 989 +145.4% 0.41x
RemoveWhereMoveInts 16 35 +118.7% 0.46x
RandomShuffleLCG2 1870 2329 +24.5% 0.80x
Improvement
Array2D 44315 12296 -72.3% 3.60x
RemoveWhereSwapStrings 896 565 -36.9% 1.59x
RemoveWhereMoveStrings 731 578 -20.9% 1.26x
CSVParsingAltIndices2 831 731 -12.0% 1.14x
ArraySubscript 1336 1223 -8.5% 1.09x (?)
RandomDoubleLCG 2171 2028 -6.6% 1.07x

Code size: -O

TEST OLD NEW DELTA SPEEDUP
Regression
RandomShuffle.o 3429 4014 +17.1% 0.85x
ArrayInClass.o 1437 1533 +6.7% 0.94x
Array2D.o 4136 4392 +6.2% 0.94x
ReversedCollections.o 9995 10555 +5.6% 0.95x
SortIntPyramids.o 9709 9933 +2.3% 0.98x
RemoveWhere.o 32532 32884 +1.1% 0.99x
Improvement
Walsh.o 9616 7920 -17.6% 1.21x
Memset.o 2392 2168 -9.4% 1.10x
XorLoop.o 2280 2168 -4.9% 1.05x
RC4.o 5150 5070 -1.6% 1.02x

Performance: -Osize

TEST OLD NEW DELTA SPEEDUP
Regression
Memset 323 3147 +874.3% 0.10x
XorLoop 412 1902 +361.6% 0.22x
ArrayInClass 87 347 +298.8% 0.25x
Sim2DArray 586 2198 +275.1% 0.27x
RemoveWhereSwapInts 19 63 +231.6% 0.30x
RemoveWhereMoveInts 15 35 +133.3% 0.43x
RC4 242 510 +110.7% 0.47x
Walsh 969 1457 +50.4% 0.67x
RandomShuffleLCG2 1837 2329 +26.8% 0.79x
Improvement
Array2D 45164 11998 -73.4% 3.76x
RemoveWhereSwapStrings 890 567 -36.3% 1.57x
RemoveWhereMoveStrings 724 583 -19.5% 1.24x
ArraySubscript 1350 1251 -7.3% 1.08x (?)

Code size: -Osize

TEST OLD NEW DELTA SPEEDUP
Regression
RandomShuffle.o 3751 3975 +6.0% 0.94x
Walsh.o 6410 6762 +5.5% 0.95x
RC4.o 4136 4296 +3.9% 0.96x
ReversedCollections.o 10709 10997 +2.7% 0.97x
RemoveWhere.o 24438 24806 +1.5% 0.99x
SortIntPyramids.o 9863 9975 +1.1% 0.99x
Improvement
Sim2DArray.o 1442 1386 -3.9% 1.04x
ArraySubscript.o 4122 4010 -2.7% 1.03x
Memset.o 2141 2093 -2.2% 1.02x
XorLoop.o 2074 2042 -1.5% 1.02x

Performance: -Onone

TEST OLD NEW DELTA SPEEDUP
Improvement
Memset 25300 12012 -52.5% 2.11x
XorLoop 13315 7591 -43.0% 1.75x
Sim2DArray 32029 19971 -37.6% 1.60x
Walsh 7356 5206 -29.2% 1.41x
Array2D 461559 341320 -26.1% 1.35x
RandomShuffleLCG2 43274 35653 -17.6% 1.21x
RC4 14585 12404 -15.0% 1.18x
SuffixAnySequence 23904 20978 -12.2% 1.14x
SuffixAnySequenceLazy 23734 21068 -11.2% 1.13x
SuffixSequence 23627 20976 -11.2% 1.13x
RemoveWhereMoveInts 3119 2778 -10.9% 1.12x
RemoveWhereSwapStrings 6259 5580 -10.8% 1.12x
RandomShuffleDef2 6808 6080 -10.7% 1.12x
SuffixSequenceLazy 23601 21086 -10.7% 1.12x
RemoveWhereMoveStrings 3668 3327 -9.3% 1.10x
RemoveWhereQuadraticString 2455 2248 -8.4% 1.09x
RemoveWhereSwapInts 5562 5104 -8.2% 1.09x
PrimsSplit 8238 7594 -7.8% 1.08x (?)
Calculator 1105 1025 -7.2% 1.08x
StringAdder 790 734 -7.1% 1.08x
SuffixAnySeqCRangeIterLazy 35446 33124 -6.6% 1.07x

Code size: Swift libraries

TEST OLD NEW DELTA SPEEDUP
Regression
libswiftSwiftOnoneSupport.dylib 217088 221184 +1.9% 0.98x
How to read the data The tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.

If you see any unexpected regressions, you should consider fixing the regressions before you merge the PR.

Noise: Sometimes the performance results (not code size!) contain false alarms. Unexpected regressions which are marked with '(?)' are probably noise. If you see regressions which you cannot explain you can try to run the benchmarks again. If regressions still show up, please consult with the performance team (@eeckstein).

Hardware Overview
  Model Name: Mac Pro
  Model Identifier: MacPro6,1
  Processor Name: 12-Core Intel Xeon E5
  Processor Speed: 2.7 GHz
  Number of Processors: 1
  Total Number of Cores: 12
  L2 Cache (per Core): 256 KB
  L3 Cache: 30 MB
  Memory: 64 GB

@swift-ci
Copy link
Contributor

swift-ci commented Sep 6, 2018

Build comment file:

Summary for master smoketest

Unexpected test results, excluded stats for Kingfisher, ReactiveCocoa

No regressions above thresholds

Debug

debug brief

Regressed (0)
name old new delta delta_pct
Improved (2)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 233,220,033,832 182,933,575,378 -50,286,458,454 -21.56% ✅
time.swift-driver.wall 26.1s 23.8s -2.3s -8.68% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (1)
name old new delta delta_pct
LLVM.NumLLVMBytesOutput 9,467,504 9,467,504 0 0.0%

debug detailed

Regressed (0)
name old new delta delta_pct
Improved (4)
name old new delta delta_pct
Sema.NumConformancesDeserialized 33,291 32,886 -405 -1.22% ✅
Sema.NumLazyGenericEnvironments 54,625 53,842 -783 -1.43% ✅
Sema.NumLazyIterableDeclContexts 45,467 44,663 -804 -1.77% ✅
Sema.NumTypesDeserialized 126,306 121,858 -4,448 -3.52% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (19)
name old new delta delta_pct
AST.NumImportedExternalDefinitions 5,966 5,966 0 0.0%
AST.NumLoadedModules 1,510 1,510 0 0.0%
AST.NumTotalClangImportedEntities 18,342 18,342 0 0.0%
AST.NumUsedConformances 1,344 1,344 0 0.0%
IRModule.NumIRBasicBlocks 31,504 31,504 0 0.0%
IRModule.NumIRFunctions 16,873 16,873 0 0.0%
IRModule.NumIRGlobals 14,446 14,446 0 0.0%
IRModule.NumIRInsts 439,874 439,874 0 0.0%
IRModule.NumIRValueSymbols 29,998 29,998 0 0.0%
LLVM.NumLLVMBytesOutput 9,467,504 9,467,504 0 0.0%
SILModule.NumSILGenFunctions 7,967 7,967 0 0.0%
SILModule.NumSILOptFunctions 10,915 10,915 0 0.0%
Sema.NumConstraintScopes 71,886 71,886 0 0.0%
Sema.NumDeclsDeserialized 272,951 271,053 -1,898 -0.7%
Sema.NumDeclsValidated 16,641 16,641 0 0.0%
Sema.NumFunctionsTypechecked 7,085 7,085 0 0.0%
Sema.NumGenericSignatureBuilders 11,563 11,550 -13 -0.11%
Sema.NumLazyGenericEnvironmentsLoaded 6,168 6,168 0 0.0%
Sema.NumTypesValidated 14,188 14,188 0 0.0%

Release

release brief

Regressed (0)
name old new delta delta_pct
Improved (2)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 231,038,678,398 221,912,042,076 -9,126,636,322 -3.95% ✅
time.swift-driver.wall 43.5s 41.8s -1.8s -4.03% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (1)
name old new delta delta_pct
LLVM.NumLLVMBytesOutput 10,579,696 10,579,696 0 0.0%

release detailed

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (23)
name old new delta delta_pct
AST.NumImportedExternalDefinitions 1,385 1,385 0 0.0%
AST.NumLoadedModules 100 100 0 0.0%
AST.NumTotalClangImportedEntities 4,901 4,901 0 0.0%
AST.NumUsedConformances 1,346 1,346 0 0.0%
IRModule.NumIRBasicBlocks 34,278 34,278 0 0.0%
IRModule.NumIRFunctions 15,110 15,110 0 0.0%
IRModule.NumIRGlobals 13,834 13,834 0 0.0%
IRModule.NumIRInsts 334,067 334,067 0 0.0%
IRModule.NumIRValueSymbols 27,839 27,839 0 0.0%
LLVM.NumLLVMBytesOutput 10,579,696 10,579,696 0 0.0%
SILModule.NumSILGenFunctions 6,190 6,190 0 0.0%
SILModule.NumSILOptFunctions 9,255 9,247 -8 -0.09%
Sema.NumConformancesDeserialized 16,343 16,297 -46 -0.28%
Sema.NumConstraintScopes 70,446 70,446 0 0.0%
Sema.NumDeclsDeserialized 52,161 52,153 -8 -0.02%
Sema.NumDeclsValidated 10,362 10,362 0 0.0%
Sema.NumFunctionsTypechecked 4,362 4,362 0 0.0%
Sema.NumGenericSignatureBuilders 2,575 2,575 0 0.0%
Sema.NumLazyGenericEnvironments 9,471 9,473 2 0.02%
Sema.NumLazyGenericEnvironmentsLoaded 1,332 1,332 0 0.0%
Sema.NumLazyIterableDeclContexts 5,823 5,825 2 0.03%
Sema.NumTypesDeserialized 30,746 30,453 -293 -0.95%
Sema.NumTypesValidated 7,103 7,103 0 0.0%

@slavapestov
Copy link
Contributor

I did not expect the compile time wins. I wonder why?

@airspeedswift
Copy link
Member Author

name delta_pct
Frontend.NumInstructionsExecuted -21.56% ✅

wat

@airspeedswift
Copy link
Member Author

@swift-ci please test compiler performance

@swift-ci
Copy link
Contributor

swift-ci commented Sep 6, 2018

Build comment file:

Summary for master full

Unexpected test results, excluded stats for RxSwift, ChattoAdditions, Wordy, ReactiveSwift

Regressions found (see below)

Debug-batch

debug-batch brief

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (3)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 13,638,391,613,767 13,621,385,555,248 -17,006,058,519 -0.12%
LLVM.NumLLVMBytesOutput 493,842,132 494,010,598 168,466 0.03%
time.swift-driver.wall 1345.7s 1345.6s -121.7ms -0.01%

debug-batch detailed

Regressed (3)
name old new delta delta_pct
SILModule.NumSILOptFunctions 671,411 678,852 7,441 1.11% ⛔
Sema.OverriddenDeclsRequest 708,928 1,529,074 820,146 115.69% ⛔
Sema.SuperclassTypeRequest 14,769 15,357 588 3.98% ⛔
Improved (1)
name old new delta delta_pct
Sema.UnderlyingTypeDeclsReferencedRequest 1,557,479 1,539,720 -17,759 -1.14% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (88)
name old new delta delta_pct
AST.NumASTBytesAllocated 13,533,913,780 13,533,676,150 -237,630 -0.0%
AST.NumDecls 33,401 33,401 0 0.0%
AST.NumDependencies 90,765 90,765 0 0.0%
AST.NumImportedExternalDefinitions 772,120 773,460 1,340 0.17%
AST.NumInfixOperators 13,113 13,113 0 0.0%
AST.NumLinkLibraries 0 0 0 0.0%
AST.NumLoadedModules 103,611 103,611 0 0.0%
AST.NumLocalTypeDecls 111 111 0 0.0%
AST.NumObjCMethods 12,397 12,397 0 0.0%
AST.NumPostfixOperators 14 14 0 0.0%
AST.NumPrecedenceGroups 6,932 6,932 0 0.0%
AST.NumPrefixOperators 60 60 0 0.0%
AST.NumReferencedDynamicNames 101 101 0 0.0%
AST.NumReferencedMemberNames 1,813,727 1,812,978 -749 -0.04%
AST.NumReferencedTopLevelNames 115,653 115,653 0 0.0%
AST.NumSourceBuffers 153,216 153,217 1 0.0%
AST.NumSourceLines 1,193,359 1,193,359 0 0.0%
AST.NumSourceLinesPerSecond 539,296 542,043 2,747 0.51%
AST.NumTotalClangImportedEntities 2,541,148 2,546,056 4,908 0.19%
AST.NumUsedConformances 101,130 101,130 0 0.0%
Driver.ChildrenMaxRSS 37,521,580,032 37,294,288,896 -227,291,136 -0.61%
Driver.DriverDepCascadingDynamic 0 0 0 0.0%
Driver.DriverDepCascadingExternal 0 0 0 0.0%
Driver.DriverDepCascadingMember 0 0 0 0.0%
Driver.DriverDepCascadingNominal 0 0 0 0.0%
Driver.DriverDepCascadingTopLevel 0 0 0 0.0%
Driver.DriverDepDynamic 0 0 0 0.0%
Driver.DriverDepExternal 0 0 0 0.0%
Driver.DriverDepMember 0 0 0 0.0%
Driver.DriverDepNominal 0 0 0 0.0%
Driver.DriverDepTopLevel 0 0 0 0.0%
Driver.NumDriverJobsRun 7,171 7,171 0 0.0%
Driver.NumDriverJobsSkipped 0 0 0 0.0%
Driver.NumDriverPipePolls 210,352 208,268 -2,084 -0.99%
Driver.NumDriverPipeReads 218,033 216,336 -1,697 -0.78%
Driver.NumProcessFailures 0 0 0 0.0%
Frontend.MaxMallocUsage 222,330,547,416 222,425,903,992 95,356,576 0.04%
Frontend.NumInstructionsExecuted 13,638,391,613,767 13,621,385,555,248 -17,006,058,519 -0.12%
Frontend.NumProcessFailures 0 0 0 0.0%
IRModule.NumIRAliases 59,044 59,044 0 0.0%
IRModule.NumIRBasicBlocks 1,746,321 1,746,666 345 0.02%
IRModule.NumIRComdatSymbols 0 0 0 0.0%
IRModule.NumIRFunctions 926,793 927,201 408 0.04%
IRModule.NumIRGlobals 1,119,204 1,119,810 606 0.05%
IRModule.NumIRIFuncs 0 0 0 0.0%
IRModule.NumIRInsts 20,114,974 20,118,828 3,854 0.02%
IRModule.NumIRNamedMetaData 35,398 35,398 0 0.0%
IRModule.NumIRValueSymbols 1,814,415 1,815,429 1,014 0.06%
LLVM.NumLLVMBytesOutput 493,842,132 494,010,598 168,466 0.03%
Parse.NumFunctionsParsed 62,780 62,780 0 0.0%
SILModule.NumSILGenDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILGenFunctions 841,272 841,617 345 0.04%
SILModule.NumSILGenGlobalVariables 15,099 15,099 0 0.0%
SILModule.NumSILGenVtables 3,778 3,778 0 0.0%
SILModule.NumSILGenWitnessTables 18,544 18,544 0 0.0%
SILModule.NumSILOptDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILOptGlobalVariables 15,511 15,511 0 0.0%
SILModule.NumSILOptVtables 7,244 7,244 0 0.0%
SILModule.NumSILOptWitnessTables 36,437 36,426 -11 -0.03%
Sema.AccessLevelRequest 868,930 868,925 -5 -0.0%
Sema.DefaultAndMaxAccessLevelRequest 22,137 22,137 0 0.0%
Sema.EnumRawTypeRequest 7,723 7,723 0 0.0%
Sema.ExtendedNominalRequest 1,496,980 1,497,660 680 0.05%
Sema.InheritedDeclsReferencedRequest 52,783,026 52,767,604 -15,422 -0.03%
Sema.InheritedTypeRequest 370,423 371,006 583 0.16%
Sema.IsDynamicRequest 789,820 789,806 -14 -0.0%
Sema.IsObjCRequest 651,291 651,277 -14 -0.0%
Sema.NamedLazyMemberLoadFailureCount 14,102 14,102 0 0.0%
Sema.NamedLazyMemberLoadSuccessCount 2,293,654 2,288,050 -5,604 -0.24%
Sema.NominalTypeLookupDirectCount 15,146,002 15,121,685 -24,317 -0.16%
Sema.NumConformancesDeserialized 1,965,564 1,965,145 -419 -0.02%
Sema.NumConstraintScopes 7,331,855 7,332,893 1,038 0.01%
Sema.NumConstraintsConsideredForEdgeContraction 13,180,279 13,181,633 1,354 0.01%
Sema.NumDeclsDeserialized 16,286,766 16,281,351 -5,415 -0.03%
Sema.NumDeclsValidated 891,629 891,624 -5 -0.0%
Sema.NumFunctionsTypechecked 644,524 645,846 1,322 0.21%
Sema.NumGenericSignatureBuilders 776,584 776,626 42 0.01%
Sema.NumLazyGenericEnvironments 3,152,849 3,151,425 -1,424 -0.05%
Sema.NumLazyGenericEnvironmentsLoaded 297,849 297,988 139 0.05%
Sema.NumLazyIterableDeclContexts 2,911,424 2,911,601 177 0.01%
Sema.NumTypesDeserialized 7,173,701 7,170,534 -3,167 -0.04%
Sema.NumTypesValidated 609,000 608,995 -5 -0.0%
Sema.NumUnloadedLazyIterableDeclContexts 2,019,878 2,019,269 -609 -0.03%
Sema.RequirementRequest 22,769 22,769 0 0.0%
Sema.SelfBoundsFromWhereClauseRequest 52,018 52,018 0 0.0%
Sema.SetterAccessLevelRequest 54,206 54,206 0 0.0%
Sema.SuperclassDeclRequest 41,793,462 41,713,211 -80,251 -0.19%
Sema.USRGenerationRequest 175,720 175,720 0 0.0%

Release

release brief

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (3)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 13,017,444,295,599 13,009,182,875,783 -8,261,419,816 -0.06%
LLVM.NumLLVMBytesOutput 475,030,224 475,181,412 151,188 0.03%
time.swift-driver.wall 2494.4s 2490.8s -3.6s -0.15%

release detailed

Regressed (0)
name old new delta delta_pct
Improved (1)
name old new delta delta_pct
Sema.NumConformancesDeserialized 953,641 936,276 -17,365 -1.82% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (22)
name old new delta delta_pct
AST.NumImportedExternalDefinitions 140,898 140,898 0 0.0%
AST.NumLoadedModules 6,613 6,613 0 0.0%
AST.NumTotalClangImportedEntities 462,731 462,818 87 0.02%
AST.NumUsedConformances 104,005 104,005 0 0.0%
IRModule.NumIRBasicBlocks 1,714,734 1,715,247 513 0.03%
IRModule.NumIRFunctions 761,434 761,795 361 0.05%
IRModule.NumIRGlobals 880,363 880,969 606 0.07%
IRModule.NumIRInsts 14,734,173 14,736,087 1,914 0.01%
IRModule.NumIRValueSymbols 1,515,130 1,516,097 967 0.06%
LLVM.NumLLVMBytesOutput 475,030,224 475,181,412 151,188 0.03%
SILModule.NumSILGenFunctions 322,846 323,195 349 0.11%
SILModule.NumSILOptFunctions 447,171 448,001 830 0.19%
Sema.NumConstraintScopes 7,252,798 7,253,920 1,122 0.02%
Sema.NumDeclsDeserialized 2,916,115 2,919,693 3,578 0.12%
Sema.NumDeclsValidated 417,299 417,299 0 0.0%
Sema.NumFunctionsTypechecked 262,074 262,074 0 0.0%
Sema.NumGenericSignatureBuilders 114,682 114,658 -24 -0.02%
Sema.NumLazyGenericEnvironments 510,990 511,188 198 0.04%
Sema.NumLazyGenericEnvironmentsLoaded 58,012 58,147 135 0.23%
Sema.NumLazyIterableDeclContexts 342,352 342,446 94 0.03%
Sema.NumTypesDeserialized 1,663,754 1,647,771 -15,983 -0.96%
Sema.NumTypesValidated 187,234 187,234 0 0.0%

@airspeedswift
Copy link
Member Author

@swift-ci please smoke benchmark

@airspeedswift
Copy link
Member Author

@swift-ci please smoke test compiler performance

@swift-ci
Copy link
Contributor

swift-ci commented Sep 6, 2018

Build comment file:

Performance: -O

TEST OLD NEW DELTA SPEEDUP
Regression
Memset 210 3148 +1399.0% 0.07x
Sim2DArray 311 2199 +607.1% 0.14x
XorLoop 402 1899 +372.4% 0.21x
ArrayInClass 87 347 +298.8% 0.25x
RemoveWhereSwapInts 20 65 +225.0% 0.31x
RC4 156 495 +217.3% 0.32x
Walsh 402 989 +146.0% 0.41x
RemoveWhereMoveInts 15 34 +126.7% 0.44x
RandomShuffleLCG2 1870 2338 +25.0% 0.80x
SequenceAlgosContiguousArray 1589 1874 +17.9% 0.85x
Improvement
Array2D 44322 12296 -72.3% 3.60x
RemoveWhereSwapStrings 897 565 -37.0% 1.59x
RemoveWhereMoveStrings 730 579 -20.7% 1.26x
IterateData 1738 1570 -9.7% 1.11x (?)
CSVParsingAltIndices2 830 761 -8.3% 1.09x
RandomDoubleLCG 2171 2028 -6.6% 1.07x (?)

Code size: -O

TEST OLD NEW DELTA SPEEDUP
Regression
RandomShuffle.o 3429 4014 +17.1% 0.85x
ArrayInClass.o 1437 1533 +6.7% 0.94x
Array2D.o 4136 4392 +6.2% 0.94x
ReversedCollections.o 9995 10555 +5.6% 0.95x
SortIntPyramids.o 9709 9933 +2.3% 0.98x
RemoveWhere.o 32532 32884 +1.1% 0.99x
Improvement
Walsh.o 9616 7920 -17.6% 1.21x
Memset.o 2392 2168 -9.4% 1.10x
XorLoop.o 2280 2168 -4.9% 1.05x
RC4.o 5150 5070 -1.6% 1.02x
SequenceAlgos.o 24197 23941 -1.1% 1.01x

Performance: -Osize

TEST OLD NEW DELTA SPEEDUP
Regression
Memset 323 3147 +874.3% 0.10x
XorLoop 400 1903 +375.7% 0.21x
ArrayInClass 87 347 +298.8% 0.25x
Sim2DArray 586 2198 +275.1% 0.27x
RemoveWhereSwapInts 19 63 +231.6% 0.30x
RemoveWhereMoveInts 15 35 +133.3% 0.43x
RC4 242 510 +110.7% 0.47x
Walsh 972 1457 +49.9% 0.67x
RandomShuffleLCG2 1834 2329 +27.0% 0.79x
Improvement
Array2D 45140 11998 -73.4% 3.76x
RemoveWhereSwapStrings 892 567 -36.4% 1.57x
RemoveWhereMoveStrings 724 582 -19.6% 1.24x
CSVParsingAltIndices2 858 787 -8.3% 1.09x
ArraySubscript 1360 1253 -7.9% 1.09x

Code size: -Osize

TEST OLD NEW DELTA SPEEDUP
Regression
RandomShuffle.o 3751 3975 +6.0% 0.94x
Walsh.o 6410 6762 +5.5% 0.95x
RC4.o 4136 4296 +3.9% 0.96x
ReversedCollections.o 10709 10997 +2.7% 0.97x
RemoveWhere.o 24438 24806 +1.5% 0.99x
SortIntPyramids.o 9863 9975 +1.1% 0.99x
Improvement
Sim2DArray.o 1442 1386 -3.9% 1.04x
ArraySubscript.o 4122 4010 -2.7% 1.03x
Memset.o 2141 2093 -2.2% 1.02x
XorLoop.o 2074 2042 -1.5% 1.02x

Performance: -Onone

TEST OLD NEW DELTA SPEEDUP
Improvement
Memset 25296 12093 -52.2% 2.09x
XorLoop 13206 7589 -42.5% 1.74x
Sim2DArray 33478 20201 -39.7% 1.66x
Walsh 7384 5215 -29.4% 1.42x
Array2D 460767 342196 -25.7% 1.35x
ArrayInClass 4843 3922 -19.0% 1.23x
RandomShuffleLCG2 43424 35713 -17.8% 1.22x
RC4 14818 12622 -14.8% 1.17x
RemoveWhereSwapInts 5536 4842 -12.5% 1.14x
RemoveWhereMoveInts 3124 2767 -11.4% 1.13x
RemoveWhereSwapStrings 6229 5553 -10.9% 1.12x
SuffixSequence 23850 21274 -10.8% 1.12x
PrimsSplit 8363 7509 -10.2% 1.11x
SuffixAnySequenceLazy 23696 21381 -9.8% 1.11x
Prims 8282 7484 -9.6% 1.11x
SuffixSequenceLazy 23539 21330 -9.4% 1.10x
RemoveWhereMoveStrings 3650 3309 -9.3% 1.10x
ArrayOfPOD 861 783 -9.1% 1.10x (?)
RemoveWhereQuadraticString 2423 2220 -8.4% 1.09x (?)

Code size: Swift libraries

TEST OLD NEW DELTA SPEEDUP
Regression
libswiftSwiftOnoneSupport.dylib 217088 221184 +1.9% 0.98x
How to read the data The tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.

If you see any unexpected regressions, you should consider fixing the regressions before you merge the PR.

Noise: Sometimes the performance results (not code size!) contain false alarms. Unexpected regressions which are marked with '(?)' are probably noise. If you see regressions which you cannot explain you can try to run the benchmarks again. If regressions still show up, please consult with the performance team (@eeckstein).

Hardware Overview
  Model Name: Mac Pro
  Model Identifier: MacPro6,1
  Processor Name: 12-Core Intel Xeon E5
  Processor Speed: 2.7 GHz
  Number of Processors: 1
  Total Number of Cores: 12
  L2 Cache (per Core): 256 KB
  L3 Cache: 30 MB
  Memory: 64 GB

@swift-ci
Copy link
Contributor

swift-ci commented Sep 6, 2018

Build comment file:

Summary for master smoketest

Unexpected test results, excluded stats for Kingfisher, ReactiveCocoa

No regressions above thresholds

Debug

debug brief

Regressed (0)
name old new delta delta_pct
Improved (1)
name old new delta delta_pct
time.swift-driver.wall 23.7s 23.0s -741.2ms -3.12% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (2)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 217,016,567,794 216,407,669,188 -608,898,606 -0.28%
LLVM.NumLLVMBytesOutput 9,443,696 9,443,816 120 0.0%

debug detailed

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (23)
name old new delta delta_pct
AST.NumImportedExternalDefinitions 5,848 5,848 0 0.0%
AST.NumLoadedModules 1,281 1,281 0 0.0%
AST.NumTotalClangImportedEntities 17,993 17,993 0 0.0%
AST.NumUsedConformances 1,344 1,344 0 0.0%
IRModule.NumIRBasicBlocks 31,450 31,450 0 0.0%
IRModule.NumIRFunctions 16,815 16,817 2 0.01%
IRModule.NumIRGlobals 14,378 14,378 0 0.0%
IRModule.NumIRInsts 439,684 439,724 40 0.01%
IRModule.NumIRValueSymbols 29,872 29,874 2 0.01%
LLVM.NumLLVMBytesOutput 9,443,696 9,443,816 120 0.0%
SILModule.NumSILGenFunctions 7,909 7,909 0 0.0%
SILModule.NumSILOptFunctions 10,715 10,715 0 0.0%
Sema.NumConformancesDeserialized 31,571 31,571 0 0.0%
Sema.NumConstraintScopes 71,184 71,184 0 0.0%
Sema.NumDeclsDeserialized 256,684 256,412 -272 -0.11%
Sema.NumDeclsValidated 16,273 16,273 0 0.0%
Sema.NumFunctionsTypechecked 7,047 7,047 0 0.0%
Sema.NumGenericSignatureBuilders 10,877 10,877 0 0.0%
Sema.NumLazyGenericEnvironments 50,557 50,493 -64 -0.13%
Sema.NumLazyGenericEnvironmentsLoaded 5,780 5,778 -2 -0.03%
Sema.NumLazyIterableDeclContexts 41,118 41,114 -4 -0.01%
Sema.NumTypesDeserialized 116,441 116,355 -86 -0.07%
Sema.NumTypesValidated 13,940 13,940 0 0.0%

Release

release brief

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (3)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 230,352,006,204 230,022,903,331 -329,102,873 -0.14%
LLVM.NumLLVMBytesOutput 10,562,808 10,520,824 -41,984 -0.4%
time.swift-driver.wall 38.9s 38.7s -129.3ms -0.33%

release detailed

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (23)
name old new delta delta_pct
AST.NumImportedExternalDefinitions 1,385 1,385 0 0.0%
AST.NumLoadedModules 100 100 0 0.0%
AST.NumTotalClangImportedEntities 4,901 4,901 0 0.0%
AST.NumUsedConformances 1,346 1,346 0 0.0%
IRModule.NumIRBasicBlocks 34,224 34,186 -38 -0.11%
IRModule.NumIRFunctions 15,052 15,036 -16 -0.11%
IRModule.NumIRGlobals 13,766 13,758 -8 -0.06%
IRModule.NumIRInsts 334,649 334,473 -176 -0.05%
IRModule.NumIRValueSymbols 27,713 27,693 -20 -0.07%
LLVM.NumLLVMBytesOutput 10,562,808 10,520,824 -41,984 -0.4%
SILModule.NumSILGenFunctions 6,136 6,136 0 0.0%
SILModule.NumSILOptFunctions 9,106 9,098 -8 -0.09%
Sema.NumConformancesDeserialized 16,579 16,567 -12 -0.07%
Sema.NumConstraintScopes 69,748 69,748 0 0.0%
Sema.NumDeclsDeserialized 52,087 52,049 -38 -0.07%
Sema.NumDeclsValidated 10,362 10,362 0 0.0%
Sema.NumFunctionsTypechecked 4,362 4,362 0 0.0%
Sema.NumGenericSignatureBuilders 2,585 2,585 0 0.0%
Sema.NumLazyGenericEnvironments 9,465 9,465 0 0.0%
Sema.NumLazyGenericEnvironmentsLoaded 1,312 1,312 0 0.0%
Sema.NumLazyIterableDeclContexts 5,821 5,821 0 0.0%
Sema.NumTypesDeserialized 30,898 30,825 -73 -0.24%
Sema.NumTypesValidated 7,103 7,103 0 0.0%

@gottesmm
Copy link
Contributor

gottesmm commented Sep 6, 2018

@airspeedswift I wonder if the memset issue is due to array hoisting failing. It could be that you are changing the pattern we are looking for so the semantic optimization for uniqueness check hoisting is not kicking in.

_makeMutableAndUnique() // makes the array native, too
_checkSubscript_native(index)
return (_getElementAddress(index), _getOwner_native())
let address = _buffer.subscriptBaseAddress + index
Copy link
Contributor

Choose a reason for hiding this comment

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

This changed has replaced the call to 'getElementAddress' which is a semantic function with its implementation. This would likely prevent uniqueness hoisting and array bounds check elimination.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok let me try putting that back. Seems a shame to have to have a symbol just for doing that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I already have a fix for this

@eeckstein
Copy link
Contributor

#19181 should fix the crash and most of the regressions (except XorLoop, which needs more work)

@airspeedswift
Copy link
Member Author

@swift-ci please smoke benchmark

@airspeedswift
Copy link
Member Author

@swift-ci please test

@swiftlang swiftlang deleted a comment from swift-ci Sep 7, 2018
@swift-ci
Copy link
Contributor

swift-ci commented Sep 7, 2018

Build failed
Swift Test Linux Platform
Git Sha - 621441664b406749bae7b5fc790e74ddb3b3c3ba

@swift-ci
Copy link
Contributor

swift-ci commented Sep 7, 2018

Build comment file:

Performance: -O

TEST OLD NEW DELTA SPEEDUP
Regression
XorLoop 394 551 +39.8% 0.72x
RemoveWhereSwapInts 20 25 +25.0% 0.80x
SequenceAlgosContiguousArray 1573 1883 +19.7% 0.84x
Improvement
Array2D 44284 12296 -72.2% 3.60x
RemoveWhereSwapStrings 895 564 -37.0% 1.59x
RemoveWhereMoveStrings 730 580 -20.5% 1.26x
CSVParsingAltIndices2 836 732 -12.4% 1.14x
CStringLongAscii 3524 3285 -6.8% 1.07x
RemoveWhereMoveInts 15 14 -6.7% 1.07x

Code size: -O

TEST OLD NEW DELTA SPEEDUP
Regression
RandomShuffle.o 3429 3762 +9.7% 0.91x
Array2D.o 4136 4392 +6.2% 0.94x
Improvement
SequenceAlgos.o 24229 23973 -1.1% 1.01x

Performance: -Osize

TEST OLD NEW DELTA SPEEDUP
Regression
XorLoop 412 626 +51.9% 0.66x
RemoveWhereSwapInts 19 25 +31.6% 0.76x
Improvement
Array2D 52789 11998 -77.3% 4.40x
RemoveWhereSwapStrings 890 567 -36.3% 1.57x
RemoveWhereMoveStrings 724 582 -19.6% 1.24x
CSVParsingAltIndices2 859 765 -10.9% 1.12x
RandomShuffleLCG2 1835 1672 -8.9% 1.10x (?)
ArraySubscript 1330 1227 -7.7% 1.08x (?)
CStringLongAscii 3530 3287 -6.9% 1.07x

Code size: -Osize

TEST OLD NEW DELTA SPEEDUP
Regression
XorLoop.o 2074 2122 +2.3% 0.98x
RandomShuffle.o 3751 3815 +1.7% 0.98x
Improvement
ArraySubscript.o 4122 4010 -2.7% 1.03x
RC4.o 4136 4056 -1.9% 1.02x

Performance: -Onone

TEST OLD NEW DELTA SPEEDUP
Improvement
Memset 25300 12299 -51.4% 2.06x
XorLoop 13313 7595 -43.0% 1.75x
Sim2DArray 32794 19936 -39.2% 1.64x
Walsh 7379 5180 -29.8% 1.42x
Array2D 459966 343560 -25.3% 1.34x
ArrayInClass 4805 3920 -18.4% 1.23x
RandomShuffleLCG2 42820 35168 -17.9% 1.22x
RC4 13902 12127 -12.8% 1.15x
RandomShuffleDef2 6693 5934 -11.3% 1.13x
SuffixAnySequence 24187 21490 -11.2% 1.13x
RemoveWhereQuadraticString 2455 2214 -9.8% 1.11x
SuffixSequenceLazy 23661 21369 -9.7% 1.11x
ArrayOfPOD 860 780 -9.3% 1.10x (?)
RemoveWhereMoveStrings 3646 3312 -9.2% 1.10x
SuffixAnySequenceLazy 23760 21624 -9.0% 1.10x
How to read the data The tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.

If you see any unexpected regressions, you should consider fixing the regressions before you merge the PR.

Noise: Sometimes the performance results (not code size!) contain false alarms. Unexpected regressions which are marked with '(?)' are probably noise. If you see regressions which you cannot explain you can try to run the benchmarks again. If regressions still show up, please consult with the performance team (@eeckstein).

Hardware Overview
  Model Name: Mac Pro
  Model Identifier: MacPro6,1
  Processor Name: 12-Core Intel Xeon E5
  Processor Speed: 2.7 GHz
  Number of Processors: 1
  Total Number of Cores: 12
  L2 Cache (per Core): 256 KB
  L3 Cache: 30 MB
  Memory: 64 GB

@airspeedswift
Copy link
Member Author

@eeckstein oddly getting a linux-only optimizer assertion now

@eeckstein
Copy link
Contributor

@airspeedswift Can you disable the test for linux and file a bug?

@airspeedswift
Copy link
Member Author

@swift-ci please smoke test

@airspeedswift airspeedswift merged commit b4a23ad into swiftlang:master Sep 7, 2018
@airspeedswift airspeedswift deleted the array-modify branch September 7, 2018 17:37
@rjmccall
Copy link
Contributor

Awesome!

nkcsgexi pushed a commit to nkcsgexi/swift that referenced this pull request Sep 10, 2018
* Switch Array to use subscript _modify

* Add _modify to ContiguousArray

* XFAIL linux failing test
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