Skip to content

[Constraint solver] Remove performance hacks for pattern type computation #29851

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
Feb 24, 2020

Conversation

DougGregor
Copy link
Member

We shouldn't need these.

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor
Copy link
Member Author

@swift-ci please test compiler performance

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

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

🎉

@swift-ci
Copy link
Contributor

Compilation-performance test failed

@DougGregor
Copy link
Member Author

@swift-ci please test Linux

@DougGregor
Copy link
Member Author

@swift-ci please smoke test compiler performance

@swift-ci
Copy link
Contributor

Compilation-performance test failed

@DougGregor
Copy link
Member Author

@swift-ci please test compiler performance

@DougGregor
Copy link
Member Author

This is getting folded into #29855 but I'm trying to get performance numbers out of it first.

@swift-ci
Copy link
Contributor

Compilation-performance test failed

@DougGregor
Copy link
Member Author

@swift-ci please test compiler performance

@swift-ci
Copy link
Contributor

Compilation-performance test failed

@DougGregor
Copy link
Member Author

@swift-ci please test compiler performance

@swift-ci
Copy link
Contributor

Summary for master full

Unexpected test results, excluded stats for RxCocoa, SwifterSwift, Base64CoderSwiftUI

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 47,466,734,264,419 47,116,020,043,985 -350,714,220,434 -0.74%
LLVM.NumLLVMBytesOutput 1,826,732,338 1,826,740,058 7,720 0.0%
time.swift-driver.wall 5237.5s 5212.7s -24.8s -0.47%

debug-batch detailed

Regressed (2)
name old new delta delta_pct
Sema.NumConstraintScopes 27,217,369 27,648,340 430,971 1.58% ⛔
Sema.NumConstraintsConsideredForEdgeContraction 91,794,493 93,072,855 1,278,362 1.39% ⛔
Improved (13)
name old new delta delta_pct
AST.NumASTBytesAllocated 57,414,671,606 56,530,614,573 -884,057,033 -1.54% ✅
Sema.AccessLevelRequest 10,751,977 10,417,062 -334,915 -3.11% ✅
Sema.AttachedPropertyWrappersRequest 2,434,442 2,315,761 -118,681 -4.88% ✅
Sema.CollectOverriddenDeclsRequest 6,545,818 6,319,822 -225,996 -3.45% ✅
Sema.ExistentialConformsToSelfRequest 12,328 12,158 -170 -1.38% ✅
Sema.GenericParamListRequest 8,775,931 8,579,465 -196,466 -2.24% ✅
Sema.InterfaceTypeRequest 13,488,596 13,296,339 -192,257 -1.43% ✅
Sema.IsFinalRequest 2,584,866 2,553,882 -30,984 -1.2% ✅
Sema.NumConformancesDeserialized 9,195,129 9,068,167 -126,962 -1.38% ✅
Sema.NumDeclsDeserialized 74,266,841 73,397,025 -869,816 -1.17% ✅
Sema.OverriddenDeclsRequest 2,390,071 2,360,008 -30,063 -1.26% ✅
Sema.ProvideDefaultImplForRequest 6,545,818 6,319,822 -225,996 -3.45% ✅
Sema.USRGenerationRequest 8,027,773 7,799,216 -228,557 -2.85% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (198)
name old new delta delta_pct
AST.ImportSetCacheHit 2,175,009 2,174,499 -510 -0.02%
AST.ImportSetCacheMiss 1,004,774 1,004,725 -49 -0.0%
AST.ImportSetFoldHit 533,178 533,155 -23 -0.0%
AST.ImportSetFoldMiss 471,596 471,569 -27 -0.01%
AST.ModuleShadowCacheHit 3,602 3,602 0 0.0%
AST.ModuleShadowCacheMiss 1,913 1,913 0 0.0%
AST.ModuleVisibilityCacheHit 34,996 34,996 0 0.0%
AST.ModuleVisibilityCacheMiss 9,090 9,090 0 0.0%
AST.NumASTScopeLookups 4,358,193 4,357,737 -456 -0.01%
AST.NumBraceStmtASTScopeExpansions 640,160 640,160 0 0.0%
AST.NumBraceStmtASTScopes 640,160 640,160 0 0.0%
AST.NumDecls 143,591 143,591 0 0.0%
AST.NumDependencies 439,824 439,898 74 0.02%
AST.NumInfixOperators 54,567 54,567 0 0.0%
AST.NumIterableTypeBodyASTScopeExpansions 276,848 276,817 -31 -0.01%
AST.NumIterableTypeBodyASTScopes 361,635 361,507 -128 -0.04%
AST.NumLinkLibraries 0 0 0 0.0%
AST.NumLoadedModules 406,143 406,143 0 0.0%
AST.NumLocalTypeDecls 255 255 0 0.0%
AST.NumModuleLookupClassMember 6,927 6,927 0 0.0%
AST.NumModuleLookupValue 54,645,993 54,632,903 -13,090 -0.02%
AST.NumObjCMethods 24,747 24,747 0 0.0%
AST.NumPostfixOperators 49 49 0 0.0%
AST.NumPrecedenceGroups 26,333 26,333 0 0.0%
AST.NumPrefixOperators 99 99 0 0.0%
AST.NumReferencedDynamicNames 189 189 0 0.0%
AST.NumReferencedMemberNames 6,473,321 6,473,248 -73 -0.0%
AST.NumReferencedTopLevelNames 565,742 565,742 0 0.0%
AST.NumSourceBuffers 592,152 592,152 0 0.0%
AST.NumSourceLines 4,795,458 4,795,458 0 0.0%
AST.NumSourceLinesPerSecond 3,434,285 3,446,634 12,349 0.36%
AST.NumTotalClangImportedEntities 2,122,921 2,108,050 -14,871 -0.7%
Driver.ChildrenMaxRSS 254,155,112,448 252,754,978,816 -1,400,133,632 -0.55%
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 28,508 28,508 0 0.0%
Driver.NumDriverJobsSkipped 0 0 0 0.0%
Driver.NumDriverPipePolls 63,851 64,378 527 0.83%
Driver.NumDriverPipeReads 51,141 51,490 349 0.68%
Driver.NumProcessFailures 0 0 0 0.0%
Frontend.MaxMallocUsage 1,408,119,200,216 1,401,958,713,744 -6,160,486,472 -0.44%
Frontend.NumInstructionsExecuted 47,466,734,264,419 47,116,020,043,985 -350,714,220,434 -0.74%
Frontend.NumProcessFailures 0 0 0 0.0%
IRModule.NumGOTEntries 242,887 242,887 0 0.0%
IRModule.NumIRAliases 199,599 199,599 0 0.0%
IRModule.NumIRBasicBlocks 6,985,087 6,985,087 0 0.0%
IRModule.NumIRComdatSymbols 0 0 0 0.0%
IRModule.NumIRFunctions 3,435,808 3,435,808 0 0.0%
IRModule.NumIRGlobals 3,748,747 3,748,747 0 0.0%
IRModule.NumIRIFuncs 0 0 0 0.0%
IRModule.NumIRInsts 88,230,193 88,230,193 0 0.0%
IRModule.NumIRNamedMetaData 137,660 137,660 0 0.0%
IRModule.NumIRValueSymbols 6,519,107 6,519,107 0 0.0%
LLVM.NumLLVMBytesOutput 1,826,732,338 1,826,740,058 7,720 0.0%
Parse.NumFunctionsParsed 274,000 274,000 0 0.0%
Parse.NumIterableDeclContextParsed 949,105 949,038 -67 -0.01%
Parse.ParseAbstractFunctionBodyRequest 250,020 250,020 0 0.0%
Parse.ParseMembersRequest 780,591 780,524 -67 -0.01%
SILGen.SILGenSourceFileRequest 27,212 27,212 0 0.0%
SILGen.SILGenWholeModuleRequest 1,285 1,285 0 0.0%
SILModule.NumSILGenDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILGenFunctions 1,733,411 1,733,411 0 0.0%
SILModule.NumSILGenGlobalVariables 54,724 54,724 0 0.0%
SILModule.NumSILGenVtables 18,938 18,938 0 0.0%
SILModule.NumSILGenWitnessTables 73,914 73,914 0 0.0%
SILModule.NumSILOptDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILOptFunctions 2,558,495 2,558,495 0 0.0%
SILModule.NumSILOptGlobalVariables 56,390 56,390 0 0.0%
SILModule.NumSILOptVtables 32,041 32,041 0 0.0%
SILModule.NumSILOptWitnessTables 171,972 171,972 0 0.0%
Sema.AbstractGenericSignatureRequest 32,882 32,882 0 0.0%
Sema.AnyObjectLookupRequest 281 281 0 0.0%
Sema.AreAllStoredPropertiesDefaultInitableRequest 23,507 23,507 0 0.0%
Sema.AttachedFunctionBuilderRequest 1 1 0 0.0%
Sema.AttachedPropertyWrapperTypeRequest 574,880 574,880 0 0.0%
Sema.CallerSideDefaultArgExprRequest 78,987 78,987 0 0.0%
Sema.ClassAncestryFlagsRequest 113,363 113,363 0 0.0%
Sema.CompareDeclSpecializationRequest 475,607 473,104 -2,503 -0.53%
Sema.CursorInfoRequest 0 0 0 0.0%
Sema.CustomAttrNominalRequest 1 1 0 0.0%
Sema.DefaultAndMaxAccessLevelRequest 59,722 59,723 1 0.0%
Sema.DefaultArgumentExprRequest 39,323 39,323 0 0.0%
Sema.DefaultArgumentInitContextRequest 458 458 0 0.0%
Sema.DefaultDefinitionTypeRequest 8,411 8,411 0 0.0%
Sema.DefaultTypeRequest 482,467 483,053 586 0.12%
Sema.DifferentiableAttributeTypeCheckRequest 0 0 0 0.0%
Sema.DirectLookupRequest 33,332,691 33,200,368 -132,323 -0.4%
Sema.DynamicallyReplacedDeclRequest 1,088,864 1,088,864 0 0.0%
Sema.EmittedMembersRequest 28,531 28,531 0 0.0%
Sema.EnumRawTypeRequest 26,227 26,227 0 0.0%
Sema.EnumRawValuesRequest 10,742 10,742 0 0.0%
Sema.ExistentialTypeSupportedRequest 18,179 18,179 0 0.0%
Sema.ExpandASTScopeRequest 7,803,889 7,803,545 -344 -0.0%
Sema.ExtendedNominalRequest 912,418 912,418 0 0.0%
Sema.ExtendedTypeRequest 86,328 86,316 -12 -0.01%
Sema.FunctionBuilderTypeRequest 1 1 0 0.0%
Sema.FunctionOperatorRequest 73,750 73,750 0 0.0%
Sema.GenericSignatureRequest 2,731,479 2,727,114 -4,365 -0.16%
Sema.GetDestructorRequest 29,008 29,008 0 0.0%
Sema.HasCircularInheritanceRequest 24,222 24,222 0 0.0%
Sema.HasCircularInheritedProtocolsRequest 10,474 10,474 0 0.0%
Sema.HasCircularRawValueRequest 9,127 9,127 0 0.0%
Sema.HasDefaultInitRequest 58,003 58,003 0 0.0%
Sema.HasDynamicMemberLookupAttributeRequest 664,008 662,994 -1,014 -0.15%
Sema.HasMemberwiseInitRequest 20,691 20,691 0 0.0%
Sema.HasMissingDesignatedInitializersRequest 26,824 26,824 0 0.0%
Sema.HasUserDefinedDesignatedInitRequest 58,014 58,014 0 0.0%
Sema.InferredGenericSignatureRequest 193,404 193,360 -44 -0.02%
Sema.InheritedDeclsReferencedRequest 5,843,540 5,801,634 -41,906 -0.72%
Sema.InheritedTypeRequest 320,953 320,614 -339 -0.11%
Sema.InheritsSuperclassInitializersRequest 28,803 28,803 0 0.0%
Sema.InitKindRequest 100,225 100,225 0 0.0%
Sema.IsABICompatibleOverrideRequest 138,427 138,427 0 0.0%
Sema.IsAccessorTransparentRequest 324,417 324,417 0 0.0%
Sema.IsCallableNominalTypeRequest 2,132 2,132 0 0.0%
Sema.IsDeclApplicableRequest 0 0 0 0.0%
Sema.IsDynamicRequest 1,785,151 1,785,151 0 0.0%
Sema.IsGetterMutatingRequest 443,533 443,533 0 0.0%
Sema.IsImplicitlyUnwrappedOptionalRequest 2,504,749 2,504,679 -70 -0.0%
Sema.IsObjCRequest 1,603,370 1,599,205 -4,165 -0.26%
Sema.IsSetterMutatingRequest 349,550 349,550 0 0.0%
Sema.IsStaticRequest 958,906 958,429 -477 -0.05%
Sema.LazyStoragePropertyRequest 2,604 2,604 0 0.0%
Sema.LookupInModuleRequest 7,222,993 7,211,094 -11,899 -0.16%
Sema.LookupPrecedenceGroupRequest 179,612 179,612 0 0.0%
Sema.MangleLocalTypeDeclRequest 510 510 0 0.0%
Sema.ModuleQualifiedLookupRequest 3,133,596 3,122,111 -11,485 -0.37%
Sema.NamedLazyMemberLoadSuccessCount 21,497,631 21,508,445 10,814 0.05%
Sema.NamingPatternRequest 211,367 211,367 0 0.0%
Sema.NeedsNewVTableEntryRequest 707,826 707,826 0 0.0%
Sema.NumAccessorBodiesSynthesized 191,884 191,884 0 0.0%
Sema.NumAccessorsSynthesized 300,823 300,823 0 0.0%
Sema.NumCrossImportsChecked 0 0 0 0.0%
Sema.NumCrossImportsFound 0 0 0 0.0%
Sema.NumCyclicOneWayComponentsCollapsed 0 0 0 0.0%
Sema.NumDeclsTypechecked 1,438,015 1,438,015 0 0.0%
Sema.NumGenericSignatureBuilders 1,404,658 1,395,148 -9,510 -0.68%
Sema.NumLazyIterableDeclContexts 9,524,492 9,487,746 -36,746 -0.39%
Sema.NumLazyRequirementSignatures 1,033,797 1,032,491 -1,306 -0.13%
Sema.NumLazyRequirementSignaturesLoaded 743,380 742,459 -921 -0.12%
Sema.NumLeafScopes 17,356,969 17,486,892 129,923 0.75%
Sema.NumTypesDeserialized 23,088,295 22,913,708 -174,587 -0.76%
Sema.NumTypesValidated 1,551,639 1,551,623 -16 -0.0%
Sema.NumUnloadedLazyIterableDeclContexts 6,619,585 6,638,883 19,298 0.29%
Sema.OpaqueReadOwnershipRequest 287,029 287,029 0 0.0%
Sema.OpaqueResultTypeRequest 0 0 0 0.0%
Sema.OperatorPrecedenceGroupRequest 747 747 0 0.0%
Sema.ParamSpecifierRequest 1,330,045 1,330,029 -16 -0.0%
Sema.PatternBindingEntryRequest 473,144 473,144 0 0.0%
Sema.PatternTypeRequest 597,025 597,025 0 0.0%
Sema.PreCheckFunctionBuilderRequest 0 0 0 0.0%
Sema.PropertyWrapperBackingPropertyInfoRequest 569,914 569,914 0 0.0%
Sema.PropertyWrapperBackingPropertyTypeRequest 574,880 574,880 0 0.0%
Sema.PropertyWrapperMutabilityRequest 643,496 643,496 0 0.0%
Sema.PropertyWrapperTypeInfoRequest 7 7 0 0.0%
Sema.ProtocolRequiresClassRequest 44,068 43,886 -182 -0.41%
Sema.QualifiedLookupRequest 5,581,051 5,555,970 -25,081 -0.45%
Sema.RangeInfoRequest 0 0 0 0.0%
Sema.RequirementRequest 120,021 120,008 -13 -0.01%
Sema.RequirementSignatureRequest 810,430 809,195 -1,235 -0.15%
Sema.RequiresOpaqueAccessorsRequest 1,340,914 1,340,914 0 0.0%
Sema.RequiresOpaqueModifyCoroutineRequest 277,349 277,349 0 0.0%
Sema.ResilienceExpansionRequest 1,899,427 1,899,363 -64 -0.0%
Sema.ResolveImplicitMemberRequest 376,846 374,437 -2,409 -0.64%
Sema.ResolveProtocolNameRequest 0 0 0 0.0%
Sema.ResultTypeRequest 706,589 706,556 -33 -0.0%
Sema.RootAndResultTypeOfKeypathDynamicMemberRequest 0 0 0 0.0%
Sema.RootTypeOfKeypathDynamicMemberRequest 0 0 0 0.0%
Sema.SelfAccessKindRequest 672,446 672,048 -398 -0.06%
Sema.SelfBoundsFromWhereClauseRequest 1,884,658 1,879,663 -4,995 -0.27%
Sema.SetterAccessLevelRequest 147,953 147,953 0 0.0%
Sema.StorageImplInfoRequest 1,450,682 1,450,682 0 0.0%
Sema.StoredPropertiesAndMissingMembersRequest 33,190 33,190 0 0.0%
Sema.StoredPropertiesRequest 374,625 374,625 0 0.0%
Sema.StructuralTypeRequest 2,342 2,342 0 0.0%
Sema.SuperclassDeclRequest 504,285 502,918 -1,367 -0.27%
Sema.SuperclassTypeRequest 61,677 61,677 0 0.0%
Sema.SynthesizeAccessorRequest 300,823 300,823 0 0.0%
Sema.SynthesizeDefaultInitRequest 5,407 5,407 0 0.0%
Sema.SynthesizeMemberwiseInitRequest 3,245 3,245 0 0.0%
Sema.TypeCheckFunctionBodyUntilRequest 538,772 538,772 0 0.0%
Sema.TypeCheckSourceFileRequest 27,532 27,532 0 0.0%
Sema.TypeDeclsFromWhereClauseRequest 31,285 31,286 1 0.0%
Sema.TypeRelationCheckRequest 0 0 0 0.0%
Sema.TypeWitnessRequest 9,899 9,889 -10 -0.1%
Sema.UnderlyingTypeDeclsReferencedRequest 295,966 294,804 -1,162 -0.39%
Sema.UnderlyingTypeRequest 39,399 39,399 0 0.0%
Sema.UnqualifiedLookupRequest 4,505,345 4,504,889 -456 -0.01%
Sema.ValueWitnessRequest 70,063 70,063 0 0.0%
TBDGen.GenerateTBDRequest 27,232 27,232 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 50,710,471,634,067 50,714,728,786,735 4,257,152,668 0.01%
LLVM.NumLLVMBytesOutput 1,850,286,130 1,850,278,706 -7,424 -0.0%
time.swift-driver.wall 9020.7s 9005.6s -15.0s -0.17%

release detailed

Regressed (1)
name old new delta delta_pct
Sema.NumConstraintScopes 26,896,666 27,310,718 414,052 1.54% ⛔
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (16)
name old new delta delta_pct
AST.NumLoadedModules 30,691 30,691 0 0.0%
AST.NumTotalClangImportedEntities 456,643 456,643 0 0.0%
IRModule.NumIRBasicBlocks 4,991,792 4,991,792 0 0.0%
IRModule.NumIRFunctions 2,831,097 2,831,097 0 0.0%
IRModule.NumIRGlobals 3,266,580 3,266,580 0 0.0%
IRModule.NumIRInsts 50,258,271 50,258,271 0 0.0%
IRModule.NumIRValueSymbols 5,732,964 5,732,964 0 0.0%
LLVM.NumLLVMBytesOutput 1,850,286,130 1,850,278,706 -7,424 -0.0%
SILModule.NumSILGenFunctions 1,212,722 1,212,722 0 0.0%
SILModule.NumSILOptFunctions 1,028,271 1,028,271 0 0.0%
Sema.NumConformancesDeserialized 3,526,238 3,526,238 0 0.0%
Sema.NumDeclsDeserialized 10,806,857 10,806,857 0 0.0%
Sema.NumGenericSignatureBuilders 279,243 279,243 0 0.0%
Sema.NumLazyIterableDeclContexts 1,314,651 1,314,651 0 0.0%
Sema.NumTypesDeserialized 5,251,567 5,251,567 0 0.0%
Sema.NumTypesValidated 841,849 841,849 0 0.0%

@DougGregor DougGregor merged commit d81161a into swiftlang:master Feb 24, 2020
@DougGregor DougGregor deleted the remove-performance-hacks branch February 24, 2020 08:46
Comment on lines -2243 to -2244
if (ty && ty->getOptionalObjectType())
return ty; // Already Optional<T>.
Copy link
Contributor

@davezarzycki davezarzycki Feb 24, 2020

Choose a reason for hiding this comment

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

Hi @DougGregor – Why is this a "performance hack"? Avoiding a type variable when the user has properly typed the pattern is good, no?

EDIT – Oh wait, this is a named pattern, not a typed pattern, so this code would never trigger, right?

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 a named pattern; it would only trigger if we've already figured out the type somehow and that type is optional. I suspect that's "never".

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