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

I have the same problem with 1.7.5 on Mac. In my case, it takes ~ 5 seconds before it notices that something changed.

Olgagr avatar Dec 21 '15 15:12 Olgagr

What version of node are you using?

RyanCavanaugh avatar Dec 21 '15 18:12 RyanCavanaugh

I'm using 5.2.0 but the same problem I had on 0.12.2. I have no problem withtsc -w in version 1.7.3.

Olgagr avatar Dec 21 '15 19:12 Olgagr

Pinging @zhengbli and @vladima.

DanielRosenwasser avatar Dec 21 '15 21:12 DanielRosenwasser

Just as a heads up everyone, you can go back to 1.7.3 with no user-facing issues. 1.7.5's only change was on file watching behavior which is what you're noticing.

DanielRosenwasser avatar Dec 21 '15 21:12 DanielRosenwasser

FWIW, I see same problem (except even slower ~ 20s delay) on Linux w/ node 4.0.0. Still slow with current snapshot 1.8.0-dev.20151222

fergusg avatar Dec 22 '15 16:12 fergusg

I tried 1.7.3 on 5.3.0/Win and it's only marginally better: 4-5s.

oliverjanik avatar Dec 22 '15 23:12 oliverjanik

Same issue on Linux with node 0.10. Delay is about 4-5 seconds. Tried 1.7.5 and 1.7.3 - same result. Here is tsconfig.json:

{
    "compilerOptions": {
        "target": "ES5",
        "module": "system",
        "moduleResolution": "node",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": true,
        "outDir": "./app"
    },
    "exclude": [
        "node_modules"
    ]
}

deflexor avatar Dec 25 '15 20:12 deflexor

Same 5s delay here (ver 1.7.5 and 1.5.3 before) on mac with following tsconfig:

{
  "compilerOptions": {
    "target": "es5",
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules"
  ]
}

kamilmac avatar Dec 27 '15 19:12 kamilmac

Same issue 5 second delay node v4.1.0 on windows.

tsconfig.json :

{
  "compilerOptions": {
    "target": "ES5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false
  },
  "exclude": [
    "node_modules",
    ".git"
  ]
}

FlorianBELLAZOUZ avatar Dec 29 '15 17:12 FlorianBELLAZOUZ

Same issue on linux, node 5.1.0. Fixed with 1.7.3.

stefk avatar Jan 07 '16 10:01 stefk

Same issue on Mac OS X 10.11. Downgrading to 1.7.3 helps partially - sometimes the watcher fires fast, most of the time there's a big delay.

realyze avatar Jan 08 '16 00:01 realyze

PR https://github.com/Microsoft/TypeScript/pull/6026 should address this issue. We should have this in shortly. sorry for the delay.

mhegazy avatar Jan 08 '16 00:01 mhegazy

Thanks for the status update @mhegazy

Looking forward for th fix. This explains a slowdown I have in my angular 2 app using lite-server

johnpapa avatar Jan 08 '16 13:01 johnpapa

I am having slow reload with typescript 1.7+, works fine with typescript 1.6.

Anybody else?

asadsahi avatar Jan 08 '16 14:01 asadsahi

@asadsahi this change was introduced between TS 1.7.3 and TS 1.7.5, if you are running into issues with TS 1.7.3 then it is a different issue.

mhegazy avatar Jan 08 '16 22:01 mhegazy

I am having same issue with typescript 1.7.3.

asadsahi avatar Jan 08 '16 23:01 asadsahi

@asadsahi that is a different issue then. can you provide more details? how many files do you have? can you share your configurations?

mhegazy avatar Jan 09 '16 00:01 mhegazy

I think it's still the same issue as many commenters pointed out. There's very little difference between 1.7.3 and 1.7.5 they're both slow compared to other watchers like gulp watch or webpack watch.

oliverjanik avatar Jan 09 '16 00:01 oliverjanik

A fix was merged in master just now and will be published tomorrow via typescript@next on npm, so if anyone is willing to give it a shot it would be great. Thanks!

zhengbli avatar Jan 14 '16 19:01 zhengbli