TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

tsc -w is unacceptably slow

Open oliverjanik opened this issue 10 years ago • 61 comments

I'm on windows. Typescript version installed via npm is 1.7.5. When I do tsc -w typescript watches for changes but its change detection is really slow. I takes about 10s before it notices I made a change and then recompiles.

What could be causing this?

Edit: Node 5.3.0

oliverjanik avatar Dec 20 '15 23:12 oliverjanik

@oliverjanik, @asadsahi, @stefk, @realyze, @johnpapa, @deflexor, @FlorianBELLAZOUZ, @kamilmac, @fergusg and @Olgagr can you give typescript@next a try, and let us know if the issue has been resolved?

mhegazy avatar Jan 14 '16 19:01 mhegazy

@mhegazy It's certainly better but still slow with a ~7s lag (1.7.3 is <<1s)

Version 1.8.0-dev.20160114

fergusg avatar Jan 14 '16 20:01 fergusg

@fergusg the fix was just merged, so it wouldn't be published until tomorrow on typescript@next. Could you try again tomorrow or build from TypeScript master if you are willing to? Thank you! It is expected that changes should be detected instantly.

zhengbli avatar Jan 14 '16 20:01 zhengbli

@zhengbli @mhegazy No probs - but I might need a fresh poke to remember!

fergusg avatar Jan 14 '16 20:01 fergusg

@mhegazy, @zhengbli, the problem is solved for me, changes are detected instantly (built from master).

stefk avatar Jan 15 '16 08:01 stefk

got "typescript": "1.8.0-dev.20160114" installed, but I am experiencing same amount of time (~ 5-6 sec on my machine) unfortunately. Am I missing something? Its quick (~1-2 s) with v1.6 though.

asadsahi avatar Jan 15 '16 09:01 asadsahi

Was just about to try this myself - doesn't look like the nightly for today built:

$ npm show typescript
...
     '1.8.0-dev.20160111': '2016-01-11T07:05:35.365Z',
     '1.8.0-dev.20160112': '2016-01-12T07:05:55.664Z',
     '1.8.0-dev.20160113': '2016-01-13T07:05:48.663Z',
     '1.8.0-dev.20160114': '2016-01-14T07:07:42.963Z' },
...

CC @DanielRosenwasser

myitcv avatar Jan 15 '16 09:01 myitcv

@asadsahi, @myitcv, looking at previous build times, it seems the nightly build won't be available before a few hours (it's 1:30 AM on the west coast). You should try building from source.

stefk avatar Jan 15 '16 09:01 stefk

@stefk - these times are UTC, hence the build would ordinarily have completed by now.

myitcv avatar Jan 15 '16 09:01 myitcv

@oliverjanik, @asadsahi, @stefk, @realyze, @johnpapa, @deflexor, @FlorianBELLAZOUZ, @kamilmac, @fergusg and @Olgagr now a new nightly was published via typescript@next, can you give it a try? version: [email protected]

zhengbli avatar Jan 15 '16 21:01 zhengbli

Updated to "[email protected]" just now, and tried. It took 12 sec to detect a change to a file. I have maybe twenty .ts files that it is watching.

offsky avatar Jan 15 '16 21:01 offsky

I've just tried @next 1.8.0-dev.20160115 and it doesn't seem to detect any changes.

fergusg avatar Jan 15 '16 21:01 fergusg

@fergusg @offsky I just found that there is a bug if you have file names with upper case letters. Is that the case for you guys?

zhengbli avatar Jan 15 '16 22:01 zhengbli

@zhengbli no uppercase for me. All lower+hyphen aaa-bbb-ccc.ts

fergusg avatar Jan 15 '16 22:01 fergusg

Same for me. All files in the form aaa-bbb-ccc.ts

offsky avatar Jan 15 '16 22:01 offsky

@fergusg @offsky I created a new tsc.js at https://gist.github.com/zhengbli/0e63584b3daf3b521671 Would you mind to try again? Sorry for the hassle.

zhengbli avatar Jan 15 '16 23:01 zhengbli

Your gist works great. Sub second file change detection.

offsky avatar Jan 16 '16 00:01 offsky

@offsky thanks for testing! the fix is merged, should be in tomorrow's nightly.

zhengbli avatar Jan 16 '16 02:01 zhengbli

@zhengbli I've just tried 1.8.0-dev.20160116 which seems to work mostly well - very fast change detection, though not instant (but <1s). But sometimes it seems to stop detecting changes (e.g., I've been modding a file and tsc -w detects those changes and then suddenly stop doing so, no matter what changes I made. Restarting tsc -w works.)

I can't make it fail consistently, though - I'll have a play to see if I can.

fergusg avatar Jan 16 '16 17:01 fergusg

@zhengbli one reason for the still slightly slow change detection may be that tsc -w still seems to be watching ./node_modules dir, even though tsconfig.json has

    "exclude": [
        "node_modules"
    ]

i.e., when I touch a .ts file in node_modules, I get change detection.

fergusg avatar Jan 16 '16 17:01 fergusg