Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Optimize strict generic signature checking performance#18279

Merged
ahejlsberg merged 2 commits into
mastermicrosoft/TypeScript:masterfrom
canonicalSignaturesmicrosoft/TypeScript:canonicalSignaturesCopy head branch name to clipboard
Sep 6, 2017
Merged

Optimize strict generic signature checking performance#18279
ahejlsberg merged 2 commits into
mastermicrosoft/TypeScript:masterfrom
canonicalSignaturesmicrosoft/TypeScript:canonicalSignaturesCopy head branch name to clipboard

Conversation

@ahejlsberg

@ahejlsberg ahejlsberg commented Sep 6, 2017

Copy link
Copy Markdown
Member

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.

@sandersn sandersn left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown

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.

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.