Skip to content

Conversation

@ahejlsberg
Copy link
Member

@ahejlsberg ahejlsberg commented Sep 6, 2017

This PR optimizes the performance of strict generic signature checking introduced in #16368. When a generic class or interface is instantiated, each generic method in the class or interface is instantiated with a fresh set of cloned type parameters (which we need to handle scenarios where different generations of the same type parameter are in scope). This leads to a lot of new type identities, and potentially a lot of work comparing those identities in strict generic checking mode. As an optimization we now base signature comparisons on "canonical instantiations" that uses a single type identity for all unconstrained type parameters.

Projects that make heavy use of generic methods see dramatically improved type check times. For example:

Only changes in RWC baselines are missing error elaborations due to improved sharing.

Fixes #18257.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Looks good!

@DanielRosenwasser
Copy link
Member

@falsandtru @arturkulig @emmanueltouzery you may want to take a look at our nightlies once this gets merged in!

@ahejlsberg ahejlsberg merged commit afdd9b5 into master Sep 6, 2017
@ahejlsberg ahejlsberg deleted the canonicalSignatures branch September 6, 2017 20:26
@arturkulig
Copy link

sorry taking so long.

It works! 🎉

with immview everything was ok even without that fix, but just changing types to extended interfaces, but I have other, commercial private project in TS and I run into the same issue where type checking whole project was impossible anymore and the same trick as with immview did not work. So as you suggested today I installed latest version from npm (2.6.0-dev-something) and it completes!
I no longer have compile it with increasing --max-old-space-size on node to run type checking too, but I'm going to leave this note here for people that would like to know cheap and very unreliable workaround for 2.5

@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants