Skip to content

Create fewer GenericSignatureBuilders, part 2 #19601

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

Conversation

slavapestov
Copy link
Contributor

No description provided.

@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - bd27b74d14f40f208d24e8f565cad059fca0689b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - bd27b74d14f40f208d24e8f565cad059fca0689b

…parameter type and not an archetype

There's no need to instantiate archetypes in the generic environment
of the declaration being opened.

A couple of diagnostics changed. They were already misleading, and the
new diagnostics, while different, are not any more misleading than
before.
In one test where we used to dump conditional requirements we now print
a message that they have not been computed yet. I couldn't come up with
a way to force them to be computed here, but for the most part this test
is just ensuring that we don't recurse forever when printing recursive
conformances.
This replaces the inefficient pattern:

  for (auto param : sig->getGenericParams()) {
    if (sig->isCanonicalTypeInContext(param)) {
      ...
    } else {
      ...
    }
  }
Generic environments and archetypes can be expensive to deserialize
if they involve a generic signature not seen before.

Also, canonicalize the witness substitutions to eliminate type
aliases, and map them to interface types, which again are cheaper
to deserialize.
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - bd27b74d14f40f208d24e8f565cad059fca0689b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - bd27b74d14f40f208d24e8f565cad059fca0689b

@slavapestov
Copy link
Contributor Author

@swift-ci Please test compiler performance

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please test compiler performance

@swift-ci
Copy link
Contributor

Build comment file:

Summary for master full

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

Regressions found (see below)

Debug-batch

debug-batch brief

Regressed (0)
name old new delta delta_pct
Improved (2)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 19,447,111,638,360 14,486,363,703,647 -4,960,747,934,713 -25.51% ✅
time.swift-driver.wall 1850.0s 1661.9s -188.1s -10.17% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (1)
name old new delta delta_pct
LLVM.NumLLVMBytesOutput 671,832,720 671,832,672 -48 -0.0%

debug-batch detailed

Regressed (1)
name old new delta delta_pct
AST.NumSourceLinesPerSecond 733,656 904,146 170,490 23.24% ⛔
Improved (18)
name old new delta delta_pct
AST.NumASTBytesAllocated 21,226,817,623 18,580,958,877 -2,645,858,746 -12.46% ✅
Driver.ChildrenMaxRSS 56,607,469,568 50,678,216,704 -5,929,252,864 -10.47% ✅
Driver.NumDriverPipePolls 232,778 213,009 -19,769 -8.49% ✅
Driver.NumDriverPipeReads 252,788 233,306 -19,482 -7.71% ✅
Frontend.MaxMallocUsage 314,755,854,352 248,148,973,032 -66,606,881,320 -21.16% ✅
Frontend.NumInstructionsExecuted 19,447,111,638,360 14,486,363,703,647 -4,960,747,934,713 -25.51% ✅
Sema.ExtendedNominalRequest 2,199,282 2,160,671 -38,611 -1.76% ✅
Sema.InheritedDeclsReferencedRequest 70,344,834 66,754,575 -3,590,259 -5.1% ✅
Sema.InheritedTypeRequest 456,791 356,600 -100,191 -21.93% ✅
Sema.NumConformancesDeserialized 2,925,441 1,980,936 -944,505 -32.29% ✅
Sema.NumDeclsDeserialized 22,768,883 22,124,027 -644,856 -2.83% ✅
Sema.NumGenericSignatureBuilders 985,267 675,062 -310,205 -31.48% ✅
Sema.NumLazyGenericEnvironments 5,052,665 4,920,655 -132,010 -2.61% ✅
Sema.NumLazyGenericEnvironmentsLoaded 470,521 94,567 -375,954 -79.9% ✅
Sema.NumLazyIterableDeclContexts 4,050,967 3,994,776 -56,191 -1.39% ✅
Sema.NumTypesDeserialized 9,254,263 8,779,402 -474,861 -5.13% ✅
Sema.NumUnloadedLazyIterableDeclContexts 2,814,480 2,762,091 -52,389 -1.86% ✅
Sema.UnderlyingTypeDeclsReferencedRequest 1,861,377 1,793,969 -67,408 -3.62% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (75)
name old new delta delta_pct
AST.NumDecls 46,267 46,267 0 0.0%
AST.NumDependencies 132,820 132,816 -4 -0.0%
AST.NumImportedExternalDefinitions 978,938 978,938 0 0.0%
AST.NumInfixOperators 19,744 19,744 0 0.0%
AST.NumLinkLibraries 0 0 0 0.0%
AST.NumLoadedModules 150,702 150,702 0 0.0%
AST.NumLocalTypeDecls 111 111 0 0.0%
AST.NumObjCMethods 13,059 13,059 0 0.0%
AST.NumPostfixOperators 14 14 0 0.0%
AST.NumPrecedenceGroups 9,238 9,238 0 0.0%
AST.NumPrefixOperators 61 61 0 0.0%
AST.NumReferencedDynamicNames 101 101 0 0.0%
AST.NumReferencedMemberNames 2,545,842 2,545,842 0 0.0%
AST.NumReferencedTopLevelNames 164,860 164,860 0 0.0%
AST.NumSourceBuffers 202,721 202,722 1 0.0%
AST.NumSourceLines 1,543,249 1,543,249 0 0.0%
AST.NumTotalClangImportedEntities 3,182,437 3,182,421 -16 -0.0%
AST.NumUsedConformances 144,605 144,605 0 0.0%
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 9,752 9,752 0 0.0%
Driver.NumDriverJobsSkipped 0 0 0 0.0%
Driver.NumProcessFailures 0 0 0 0.0%
Frontend.NumProcessFailures 0 0 0 0.0%
IRModule.NumIRAliases 74,661 74,661 0 0.0%
IRModule.NumIRBasicBlocks 2,503,089 2,503,089 0 0.0%
IRModule.NumIRComdatSymbols 0 0 0 0.0%
IRModule.NumIRFunctions 1,277,002 1,277,002 0 0.0%
IRModule.NumIRGlobals 1,480,879 1,480,879 0 0.0%
IRModule.NumIRIFuncs 0 0 0 0.0%
IRModule.NumIRInsts 27,185,596 27,185,614 18 0.0%
IRModule.NumIRNamedMetaData 47,563 47,563 0 0.0%
IRModule.NumIRValueSymbols 2,459,087 2,459,087 0 0.0%
LLVM.NumLLVMBytesOutput 671,832,720 671,832,672 -48 -0.0%
Parse.NumFunctionsParsed 1,514,222 1,514,222 0 0.0%
Parse.NumIterableDeclContextParsed 535,274 535,274 0 0.0%
SILModule.NumSILGenDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILGenFunctions 1,103,468 1,103,468 0 0.0%
SILModule.NumSILGenGlobalVariables 24,671 24,671 0 0.0%
SILModule.NumSILGenVtables 4,636 4,636 0 0.0%
SILModule.NumSILGenWitnessTables 27,502 27,502 0 0.0%
SILModule.NumSILOptDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILOptFunctions 928,791 928,791 0 0.0%
SILModule.NumSILOptGlobalVariables 25,136 25,136 0 0.0%
SILModule.NumSILOptVtables 8,850 8,850 0 0.0%
SILModule.NumSILOptWitnessTables 55,741 55,741 0 0.0%
Sema.AccessLevelRequest 1,294,892 1,294,881 -11 -0.0%
Sema.DefaultAndMaxAccessLevelRequest 31,167 31,167 0 0.0%
Sema.EnumRawTypeRequest 10,424 10,424 0 0.0%
Sema.IsDynamicRequest 1,203,185 1,203,185 0 0.0%
Sema.IsObjCRequest 1,004,619 1,004,619 0 0.0%
Sema.NamedLazyMemberLoadFailureCount 17,539 17,539 0 0.0%
Sema.NamedLazyMemberLoadSuccessCount 4,145,978 4,183,433 37,455 0.9%
Sema.NominalTypeLookupDirectCount 23,947,242 23,910,447 -36,795 -0.15%
Sema.NumConstraintScopes 10,678,192 10,678,098 -94 -0.0%
Sema.NumConstraintsConsideredForEdgeContraction 20,194,036 20,193,573 -463 -0.0%
Sema.NumDeclsValidated 1,202,399 1,202,399 0 0.0%
Sema.NumFunctionsTypechecked 835,939 835,939 0 0.0%
Sema.NumTypesValidated 779,422 779,422 0 0.0%
Sema.OverriddenDeclsRequest 1,071,232 1,071,232 0 0.0%
Sema.RequirementRequest 22,895 22,731 -164 -0.72%
Sema.SelfBoundsFromWhereClauseRequest 63,121 63,121 0 0.0%
Sema.SetterAccessLevelRequest 77,901 77,901 0 0.0%
Sema.SuperclassDeclRequest 54,901,786 54,900,789 -997 -0.0%
Sema.SuperclassTypeRequest 17,741 17,741 0 0.0%
Sema.TypeDeclsFromWhereClauseRequest 14,457 14,457 0 0.0%
Sema.USRGenerationRequest 234,940 234,940 0 0.0%

Release

release brief

Regressed (0)
name old new delta delta_pct
Improved (2)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 18,721,184,578,834 17,968,187,380,055 -752,997,198,779 -4.02% ✅
time.swift-driver.wall 3534.0s 3397.0s -137.0s -3.88% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (1)
name old new delta delta_pct
LLVM.NumLLVMBytesOutput 565,966,554 565,966,642 88 0.0%

release detailed

Regressed (1)
name old new delta delta_pct
Sema.NumLazyGenericEnvironments 888,691 923,953 35,262 3.97% ⛔
Improved (4)
name old new delta delta_pct
Sema.NumConformancesDeserialized 1,439,159 1,250,139 -189,020 -13.13% ✅
Sema.NumGenericSignatureBuilders 153,394 121,445 -31,949 -20.83% ✅
Sema.NumLazyGenericEnvironmentsLoaded 97,451 15,946 -81,505 -83.64% ✅
Sema.NumTypesDeserialized 2,363,438 2,276,977 -86,461 -3.66% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (18)
name old new delta delta_pct
AST.NumImportedExternalDefinitions 178,012 178,012 0 0.0%
AST.NumLoadedModules 9,987 9,987 0 0.0%
AST.NumTotalClangImportedEntities 575,904 575,905 1 0.0%
AST.NumUsedConformances 147,720 147,720 0 0.0%
IRModule.NumIRBasicBlocks 2,516,439 2,516,439 0 0.0%
IRModule.NumIRFunctions 1,026,944 1,026,944 0 0.0%
IRModule.NumIRGlobals 1,146,302 1,146,302 0 0.0%
IRModule.NumIRInsts 20,072,383 20,072,401 18 0.0%
IRModule.NumIRValueSymbols 2,007,270 2,007,270 0 0.0%
LLVM.NumLLVMBytesOutput 565,966,554 565,966,642 88 0.0%
SILModule.NumSILGenFunctions 441,528 441,528 0 0.0%
SILModule.NumSILOptFunctions 630,607 630,607 0 0.0%
Sema.NumConstraintScopes 10,396,071 10,395,690 -381 -0.0%
Sema.NumDeclsDeserialized 4,284,891 4,270,324 -14,567 -0.34%
Sema.NumDeclsValidated 565,346 565,346 0 0.0%
Sema.NumFunctionsTypechecked 347,306 347,306 0 0.0%
Sema.NumLazyIterableDeclContexts 508,167 507,464 -703 -0.14%
Sema.NumTypesValidated 249,599 249,599 0 0.0%

@slavapestov slavapestov merged commit 2b67b0c into swiftlang:master Sep 28, 2018
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.

2 participants