Skip to content

[Sema] Omit recording some conversion restrictions in constraint solutions #18494

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
Aug 4, 2018

Conversation

gregomni
Copy link
Contributor

@gregomni gregomni commented Aug 3, 2018

Omit recording conversion restrictions in a solution that apply can just as easily figure out itself from the shape of the types. This is an implementation discussed in #18345.

Helps resolve SR-8314.

Recording and simplifying these types of restrictions takes almost 75% of the total compilation time in the test file in SR-8314, and by inspection, the coercion code executed in CSApply is exactly the same with or without.

…ust as easily figure out itself from the shape of the types.
@gregomni gregomni requested review from xedin and rudkx August 3, 2018 18:09
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.

This seems reasonable to me. For posterity - the reason why we can avoid recording these restriction types is because coerceToType already detects and handles them after the restriction switch so this is effectively a code deduplication.

@xedin
Copy link
Contributor

xedin commented Aug 3, 2018

@gregomni I guess alternative approach might be to keep restrictions but remove follow up code in coerceToType and see what breaks?

Looks like source compatibility testing is broken at the moment so let's wait a bit before merging this, just in case we've missed something.

Copy link
Contributor

@rudkx rudkx left a comment

Choose a reason for hiding this comment

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

Yeah this seems totally reasonable.

@xedin
Copy link
Contributor

xedin commented Aug 3, 2018

@swift-ci please test source compatibility

@xedin
Copy link
Contributor

xedin commented Aug 3, 2018

@swift-ci please test

@xedin
Copy link
Contributor

xedin commented Aug 4, 2018

@swift-ci please smoke test compiler performance

@swift-ci
Copy link
Contributor

swift-ci commented Aug 4, 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 19.7s 19.5s -205.6ms -1.04% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (1)
name old new delta delta_pct
LLVM.NumLLVMBytesOutput 9,429,960 9,429,960 0 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,978 5,978 0 0.0%
AST.NumLoadedModules 1,281 1,281 0 0.0%
AST.NumTotalClangImportedEntities 17,774 17,774 0 0.0%
AST.NumUsedConformances 1,285 1,285 0 0.0%
IRModule.NumIRBasicBlocks 31,452 31,452 0 0.0%
IRModule.NumIRFunctions 17,230 17,230 0 0.0%
IRModule.NumIRGlobals 14,039 14,039 0 0.0%
IRModule.NumIRInsts 439,204 439,204 0 0.0%
IRModule.NumIRValueSymbols 29,460 29,460 0 0.0%
LLVM.NumLLVMBytesOutput 9,429,960 9,429,960 0 0.0%
SILModule.NumSILGenFunctions 8,060 8,060 0 0.0%
SILModule.NumSILOptFunctions 11,016 11,016 0 0.0%
Sema.NumConformancesDeserialized 40,982 40,982 0 0.0%
Sema.NumConstraintScopes 74,281 74,281 0 0.0%
Sema.NumDeclsDeserialized 259,195 259,195 0 0.0%
Sema.NumDeclsValidated 19,506 19,506 0 0.0%
Sema.NumFunctionsTypechecked 5,036 5,036 0 0.0%
Sema.NumGenericSignatureBuilders 11,918 11,918 0 0.0%
Sema.NumLazyGenericEnvironments 50,752 50,752 0 0.0%
Sema.NumLazyGenericEnvironmentsLoaded 5,999 5,999 0 0.0%
Sema.NumLazyIterableDeclContexts 38,500 38,500 0 0.0%
Sema.NumTypesDeserialized 277,064 277,064 0 0.0%
Sema.NumTypesValidated 35,914 35,914 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) (2)
name old new delta delta_pct
LLVM.NumLLVMBytesOutput 10,537,056 10,537,056 0 0.0%
time.swift-driver.wall 32.7s 32.8s 105.1ms 0.32%

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,411 1,411 0 0.0%
AST.NumLoadedModules 100 100 0 0.0%
AST.NumTotalClangImportedEntities 4,902 4,902 0 0.0%
AST.NumUsedConformances 1,287 1,287 0 0.0%
IRModule.NumIRBasicBlocks 34,285 34,285 0 0.0%
IRModule.NumIRFunctions 15,390 15,390 0 0.0%
IRModule.NumIRGlobals 13,539 13,539 0 0.0%
IRModule.NumIRInsts 333,823 333,823 0 0.0%
IRModule.NumIRValueSymbols 27,422 27,422 0 0.0%
LLVM.NumLLVMBytesOutput 10,537,056 10,537,056 0 0.0%
SILModule.NumSILGenFunctions 6,207 6,207 0 0.0%
SILModule.NumSILOptFunctions 9,400 9,400 0 0.0%
Sema.NumConformancesDeserialized 19,784 19,784 0 0.0%
Sema.NumConstraintScopes 72,849 72,849 0 0.0%
Sema.NumDeclsDeserialized 55,114 55,114 0 0.0%
Sema.NumDeclsValidated 12,645 12,645 0 0.0%
Sema.NumFunctionsTypechecked 3,079 3,079 0 0.0%
Sema.NumGenericSignatureBuilders 2,835 2,835 0 0.0%
Sema.NumLazyGenericEnvironments 9,817 9,817 0 0.0%
Sema.NumLazyGenericEnvironmentsLoaded 1,382 1,382 0 0.0%
Sema.NumLazyIterableDeclContexts 5,644 5,644 0 0.0%
Sema.NumTypesDeserialized 71,315 71,315 0 0.0%
Sema.NumTypesValidated 17,086 17,086 0 0.0%

@xedin xedin merged commit 1d47dc9 into swiftlang:master Aug 4, 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.

4 participants