Skip to content

Compiler hangs with 2.5.0-dev.20170613 #16511

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
falsandtru opened this issue Jun 14, 2017 · 13 comments · Fixed by #18231
Closed

Compiler hangs with 2.5.0-dev.20170613 #16511

falsandtru opened this issue Jun 14, 2017 · 13 comments · Fixed by #18231
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@falsandtru
Copy link
Contributor

It was working until 2.4.0.

https://travis-ci.org/falsandtru/spica/jobs/242650734

TypeScript Version: 2.5.0-dev.20170613

Code

https://github.com/falsandtru/spica

Expected behavior:

pass

Actual behavior:

$ gulp test
[09:29:50] Using gulpfile ...\spica\gulpfile.js
[09:29:50] Starting 'clean'...
[09:29:50] Finished 'clean' after 10 ms
[09:29:50] Starting 'test'...
[09:29:50] Starting 'ts:test'...

<--- Last few GCs --->

[8108:000001D865C4C640]   191743 ms: Mark-sweep 1401.1 (1504.4) -> 1401.1 (1504.4) MB, 5382.0 / 0.0 ms  allocation failure GC in old space requested
[8108:000001D865C4C640]   196651 ms: Mark-sweep 1401.1 (1504.4) -> 1401.1 (1473.4) MB, 4907.0 / 0.0 ms  last resort
[8108:000001D865C4C640]   201277 ms: Mark-sweep 1401.1 (1473.4) -> 1401.0 (1473.4) MB, 4624.0 / 0.0 ms  last resort


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 000002707D029891 <JS Object>
    1: set [native collection.js:~247] [pc=00000272AD3ED052](this=000000DA342CCA89 <a Map with map 00000362EC684AE9>,p=0000038C322A0099 <String[9]: 1653672:2>,x=0000038C322A00C1 <a TypeObject with map 00000362EC6E9249>)
    2: getTypeWithThisArgument [...\spica\node_modules\typescript\lib\typescript.js:~31548] [pc=00000272AD3BC751](this=000001933E08A311 <JS Global Ob...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
@mhegazy mhegazy added the Bug A bug in TypeScript label Jun 14, 2017
@falsandtru
Copy link
Contributor Author

@sandersn Any updates?

@sandersn
Copy link
Member

When I updated spica to master, it compiles in 14.6 seconds on my machine. Before #17984, it compiles in 26.92 seconds. Are you still seeing oomemory crashes?

@falsandtru
Copy link
Contributor Author

Yep, I got crashes when repeating code compiling, using gulp watch. Anyways, a compiler is still too heavy and slow (needs 2.2 min).

@sandersn
Copy link
Member

When does the 2.2 minute compile time happen? Is it gulp watch? (I just tried tsc in the project root).

@falsandtru
Copy link
Contributor Author

Here is my log:

$ gulp watch
[06:51:03] Using gulpfile ...\gulpfile.js
[06:51:03] Starting 'clean'...
[06:51:03] Finished 'clean' after 11 ms
[06:51:03] Starting 'watch'...
[06:51:03] Starting 'ts:test'...
[06:51:05] Finished 'watch' after 1.79 s
[06:53:15] Finished 'ts:test' after 2.2 min
[06:53:15] Starting 'ts:watch'...
[06:53:15] Finished 'ts:watch' after 664 ms
[06:53:15] Starting 'karma:watch'...

You may not have compiled .test.ts files.

@sandersn
Copy link
Member

Yes, when I did try gulp I ran ts:dist. When I run gulp test, I get the following output:

[08:30:20] Using gulpfile ~/src/spica/gulpfile.js
[08:30:20] Starting 'clean'...
[08:30:20] Finished 'clean' after 5.3 ms
[08:30:20] Starting 'test'...
[08:30:20] Starting 'ts:test'...
[08:30:56] Finished 'ts:test' after 35 s
[08:30:56] Starting 'karma:test'...

So it looks like the performance improves considerably with master, even when building tests.

@falsandtru
Copy link
Contributor Author

I ran CI tests with latest nightly build.

https://travis-ci.org/falsandtru/spica/builds/268032017

On Linux, performance has improved but not enough as follows.

[15:56:22] Starting 'ts:test'...
[15:56:49] Finished 'ts:test' after 27 s

On OSX, improved but takes a long time, about 200%.

[17:08:35] Starting 'ts:test'...
[17:09:15] Finished 'ts:test' after 40 s

On Win locally, improved but takes a long time over 200%.

[00:49:35] Starting 'ts:test'...
[00:50:43] Finished 'ts:test' after 1.13 min

With v2.4.0, just a 9.6 sec.

https://travis-ci.org/falsandtru/spica/jobs/264343733

[12:46:14] Starting 'ts:test'...
[12:46:24] Finished 'ts:test' after 9.6 s

Compile time is increased to over 700%.

@sandersn
Copy link
Member

sandersn commented Aug 24, 2017

I forgot to mention this earlier, but have you tried --noStrictGenericChecks ? If it's slow only 2.4.1 and after, then skipping the improving checking should speed things up considerably. There is a 7x speedup when running bare tsc on spica -- around 14 seconds down to 2 or so. Of course you probably want to compile with the improved checks on sometimes, but for incremental compilation it might be worthwhile to turn them off.

@falsandtru
Copy link
Contributor Author

falsandtru commented Aug 24, 2017

I don't want to weaken type checks. And this package is also compiled from other projects like https://github.com/falsandtru/typed-dom and https://github.com/falsandtru/pjax-api. So you are requesting to use --noStrictGenericChecks for all projects using this package. It is impractical. Additionally, I believe you shouldn't spoil the usability on Win and Mac machines.

@falsandtru
Copy link
Contributor Author

I have read your edited comment. Incremental compilation is nice to me but seems like not implemented. And performance gap on Win and Mac is a different problem. Can you reduce that?

@sandersn
Copy link
Member

Sorry, I meant gulp watch compilation. I believe the performance gap is due to differences in node itself on the different platforms -- what are your 2.4.0 numbers on different machines?

I'm looking at compilation times for complex code right now, but I haven't looked at platform-caused differences.

@falsandtru
Copy link
Contributor Author

falsandtru commented Aug 28, 2017

due to differences in node itself on the different platform -- what are your 2.4.0 numbers on different machines?

I've compared that on Mac. So I don't think it is a result of platform difference.

On OSX with TypeScript 2.6.0-dev.20170824:

40 sec

https://travis-ci.org/falsandtru/spica/jobs/268032020

[17:08:35] Starting 'ts:test'...
[17:09:15] Finished 'ts:test' after 40 s

On OSX with TypeScript 2.4.0:

9.6 sec

https://travis-ci.org/falsandtru/spica/jobs/264343733

[12:46:14] Starting 'ts:test'...
[12:46:24] Finished 'ts:test' after 9.6 s

This difference is made on the same platform. Probably Windows has a similar performance problem too.

@ahejlsberg ahejlsberg assigned ahejlsberg and unassigned sandersn Sep 3, 2017
@ahejlsberg ahejlsberg added the Fixed A PR has been merged for this issue label Sep 3, 2017
@mhegazy mhegazy added this to the TypeScript 2.5.3 milestone Sep 6, 2017
@mhegazy mhegazy removed this from the TypeScript 2.6 milestone Sep 6, 2017
@falsandtru
Copy link
Contributor Author

Seems like platform-based performance problem is resolved too by #18231. Thanks @sandersn @ahejlsberg .

@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
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants