Skip to content

Too much compile time to resolve a complex function signiture definition. #7082

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

Closed
tetsuharuohzeki opened this issue Feb 15, 2016 · 7 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@tetsuharuohzeki
Copy link
Contributor

Example Environment

Abstraction

I found the case that the compile time of tsc increases to ~15x to resolve a complex function signature definition when I update rxjs to 5.0.0-beta.2 from 5.0.0-beta.1 (karen-irc/karen#574).

But after this commit, the compile time was recovered to the previous one.

beta.1 beta.2 beta.2 + explicit type annotations
Files: 111 124 124
Lines: 28560 29011 29012
Nodes: 119182 125219 125258
Identifiers: 44304 46931 46945
Symbols: 2960494 5126214 3375603
Types: 66178 1069572 41087
Memory used: 165777K 1264781K 118627K
I/O read: 0.03s 0.04s 0.04s
I/O write: 0.32s 0.31s 0.22s
Parse time: 0.48s 0.73s 0.64s
Bind time: 0.28s 0.41s 0.31s
Check time: 1.83s 31.48s 1.67s
Emit time: 0.52s 1.53s 0.43s
Total time: 3.10s 34.15s 3.05s

[email protected] has some pretty complex type signitured functions:

I know the type inference is not omnipotent, it need a complex computations, and this issue may be a corner-case of TypeScript compiler.
But I also think this would be a problem if libraries having a complex type signatures rises in the future.

Could you resolve this problem?

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Feb 16, 2016
@RyanCavanaugh
Copy link
Member

@vladima do you think this is related to the other perf regression we tracked down a couple weeks ago?

@tetsuharuohzeki
Copy link
Contributor Author

As an additional information, I tried to upgrade to [email protected] from [email protected] for the private code of my day job.

This is the comparison (sorry, I forgot diagnostic options...):

This upgrading needs some migration to my code thus this is not simply comparison. But this indicates that the type definitions of rxjs v5 is more complex than v4.

@vladima
Copy link
Contributor

vladima commented Mar 2, 2016

Fix is checked in and should be available on today's nightly build: typescript@next on npm. Can you give it a try and check if it resolves your issue?

@tetsuharuohzeki
Copy link
Contributor Author

okay, I'll try [email protected]

@vladima
Copy link
Contributor

vladima commented Mar 2, 2016

Seems that today's next does not include the fix, can you either try next tomorrow or use tsc.js built from master (I've pasted it here)

@tetsuharuohzeki
Copy link
Contributor Author

@vladima

This is the result with [email protected] (on MacBook Pro (Retina, 15-inch, Mid 2014, 2.8 GHz Intel Core i7, 16 GB 1600 MHz DDR3))
I feel there would be no problem. Thank you!

without type paramter with type parameter explicitly
Files: 124 124
Lines: 29011 29012
Nodes: 125219 125258
Identifiers: 46931 46945
Symbols: 3401852 3376452
Types: 56016 41557
Memory used: 140577K 127098K
I/O read: 0.03s 0.04s
I/O write: 0.02s 0.02s
Parse time: 0.35s 0.36s
Bind time: 0.24s 0.23s
Check time: 1.24s 1.01s
Emit time: 0.15s 0.15s
Total time: 1.99s 1.75s

@mhegazy mhegazy modified the milestones: Salsa 1.9, TypeScript 2.0 Mar 3, 2016
@vladima
Copy link
Contributor

vladima commented Mar 3, 2016

#7372 ports this fix to the next point release

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Mar 10, 2016
@mhegazy mhegazy closed this as completed Mar 10, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants