Skip to content

[Type checker] Don't create new generic signature builders for known signatures #12091

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 25, 2017

Conversation

DougGregor
Copy link
Member

Stop creating new GSBs when the generic signature is always known a priori, i.e.,

  • When we have a non-generic member of a generic type
  • We have an unconstrained extension of a generic type or protocol

When type-checking a function or subscript that itself does not have generic
parameters (but is within a generic context), we were creating a generic
signature builder which will always produce the same generic signature as
the enclosing context. Stop creating that generic signature builder.

Instead, teach the CompleteGenericTypeResolver to use the generic signature
+ the canonical generic signature builder for that signature to resolve
types, which also eliminates some extraneous re-type-checking.

Improves type-checking performance of the standard library by 36%.
…ype.

An unconstrained extension will always have the same generic signature as the
nominal type it extends. Rather can constructing a new generic signature
builder to tell us that, just re-use the generic signature. Improves
type-checking performance of the standard library by 15%.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

2 similar comments
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@DougGregor DougGregor merged commit 01dff6d into swiftlang:master Sep 25, 2017
@DougGregor DougGregor deleted the fewer-fewer-gsbs branch September 25, 2017 07:45
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.

1 participant