Skip to content

Remove some unnecessary mapTypeIntoContext calls from CSGen. #11743

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

Conversation

jrose-apple
Copy link
Contributor

These helpers are all about trying to decide if a particular overload is "favored", but the answer won't change if a local archetype is actually the type we're looking for, so there's no advantage to using contextual types over interface types. On top of that, the calls to mapTypeIntoContext are forcing the deserialization of several generic environments that would have otherwise been left untouched, resulting in unnecessary calls to the generic signature builder.

This isn't a recent change, but we're seeing strain around the generic signature builder and complex constraints in the standard library anyway, so we'll take wins where we can get them.

Discovered as part of the performance investigation in rdar://problem/33984386.

These helpers are all about trying to decide if a particular overload
is "favored", but the answer won't change if a local archetype is
actually the type we're looking for, so there's no advantage to using
contextual types over interface types. On top of that, the calls to
mapTypeIntoContext are forcing the deserialization of several generic
environments that would have otherwise been left untouched, resulting
in unnecessary calls to the generic signature builder.

This isn't a recent change, but we're seeing strain around the generic
signature builder and complex constraints in the standard library
anyway, so we'll take wins where we can get them.

Discovered as part of the performance investigation in
rdar://problem/33984386.
@jrose-apple jrose-apple force-pushed the interface-types-are-better-than-contextual-types branch from 826bdea to 54219ea Compare September 2, 2017 00:51
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Sep 2, 2017

Build failed
Swift Test Linux Platform
Git Sha - 826bdeab200d43dca9d66d0155f510b9bf8b05f7

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

@swift-ci
Copy link
Contributor

swift-ci commented Sep 2, 2017

Build failed
Swift Test OS X Platform
Git Sha - 826bdeab200d43dca9d66d0155f510b9bf8b05f7

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

LGTM.

@jrose-apple jrose-apple merged commit 4e50e4e into swiftlang:master Sep 5, 2017
@jrose-apple jrose-apple deleted the interface-types-are-better-than-contextual-types branch September 5, 2017 20:24
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