Description
Using TS2.1, our build times are painfully slow. This seems to be partially TS's fault, and partially Tsify's fault.
Here is the result of tsc --diagnostics
:
Files: 706
Lines: 121760
Nodes: 516136
Identifiers: 167590
Symbols: 265945
Types: 87899
Memory used: 391582K
I/O read: 0.05s
I/O write: 0.15s
Parse time: 1.57s
Bind time: 0.76s
Check time: 5.07s
Emit time: 1.92s
Total time: 9.31s
And 3rd compilation after running tsc -w --diagnostics
:
Files: 706
Lines: 121760
Nodes: 516136
Identifiers: 167590
Symbols: 265945
Types: 87899
Memory used: 684821K
I/O read: 0.00s
I/O write: 0.04s
Parse time: 0.25s
Bind time: 0.00s
Check time: 3.54s
Emit time: 0.86s
Total time: 4.65s
Using Tsify + Browserify, each incremental compile takes ~8s (~10s with sourcemaps). There's already an issue tracking this slowness on TSify's end, and I'm looking into ways to improve the bundle stitching time (Rollup, SystemJS, concat, etc.) on our end.
I was wondering what the TS team's advice is for improving Check time more generally. What are common gotchas, and patterns to avoid? Are there specific build flags that are helpful (eg. noEmitOnError
)? A coworker pointed out that in Scala and Haskell, adding param and return type annotations to all function signatures yield huge improvements in build times - is this the case with TypeScript too?
Thanks!
Also see #10018.