Hi,
I wanted to try the new option useTypescriptIncrementalApi. But our build time was as follows:
initial incremental
with 4 workers: 31s 10s
with one worker: 50s 30s
with useTypescriptIncrementalApi: 180s 10s
Incremental was only change to one file, so a little strange to see the difference between 4 workers and 1 worker. Any insights?
We got no incremental build time improvment and a initial build time slow down?
setup:
new ForkTsCheckerWebpackPlugin({
checkSyntacticErrors: true,
async: false,
tsconfig: root('./tsconfig.json'),
tslint: root('./tslint.json'),
useTypescriptIncrementalApi: true,
measureCompilationTime: true,
workers: 1
});
tsconfig.js:
{
"compilerOptions": {
"sourceMap": true,
"target": "es5",
"module": "commonjs",
"noImplicitAny": false,
"noImplicitReturns": true,
"noUnusedLocals": true,
"preserveConstEnums": true,
"removeComments": true,
"version": true,
"importHelpers": true,
"skipLibCheck": true,
"typeRoots": [
"./typings",
"./node_modules/@types"
],
"lib": [
"es5",
"dom",
"scripthost",
"es2015.core",
"es2015.promise",
"ES2016.Array.Include",
"ESNext.Array"
]
},
"exclude": [
"node_modules",
"build",
"coverage",
".idea",
".vscode",
"config"
]
}
package.js
devDependencies: {
"fork-ts-checker-webpack-plugin": "1.0.0-alpha.2",
"thread-loader": "1.2.0",
"ts-loader": "4.4.2",
"typescript": "3.0.1",
"webpack": "4.16.3",
"webpack-cli": "3.1.0",
"webpack-dev-server": "3.1.5"
},
"engines": {
"node": "8.9.4"
}
I don't think you can be using the version of the plugin specified as the plugin does not support multiple workers with the incremental build API mode. Do you want to double check?
Also, check out this example: https://github.com/TypeStrong/ts-loader/tree/master/examples/fork-ts-checker-webpack-plugin
Hi,
Thanks for the quick reply! :)
The multiple worker is without useTypescriptIncrementalApi flag set, just to illustrate different settings and results. Settings are like under setup section.
Do you have the latest version? I can't guarantee it's going to be faster for you but my own experience has been significant. About 4 times faster.
Suggest you change your config to:
new ForkTsCheckerWebpackPlugin({
tsconfig: root('./tsconfig.json'),
tslint: root('./tslint.json'),
useTypescriptIncrementalApi: true,
measureCompilationTime: true,
workers: 1
});
Hi, @Kavorka79.
Just to give more context - could you provide some info about your codebase:
tsc --watch and see how much time it takes? Also, to give you some more history of useTypescriptIncrementalApi, it was inspired by compiling the sources of Visual Studio Code (which I encourage to do, just to have a better feeling). They are compiling the sources with tsc directly. Here are some very rough measurements that I have from my own repository and vscode repository (by old I mean useTypescriptIncrementalApi: false and 4 workers):
| codebase | compiler setup | files | total size | initial compilation | incremental compilation | initial compilation (old)| incremental compilation (old) |
|-|-|-|-|-|-|-|-|
| my repo | webpack (dev-server) | 150 | 1.5 MB | 12 s | 0.5-4s | 8s | 2s |
| vscode | tsc --watch | 2500 | 20MB | 20s | 0.3-5s |
Currently, I have a feeling that performance of typescript incremental compilation depends on how sources are organized: less globals -> faster incremental compilation.
Hi, are any updates on this issue ?
I have about 6k files in my repo. Compilation with "useTypescriptIncrementalApi: true" takes 300+s without linters, when with "useTypescriptIncrementalApi: false" about 90s with a single worker
TS v3.5.3
fork-ts-checker-webpack-plugin v1.5.0
webpack v4.40.2
Just FYI, I was recently trying to get some performance measurements for webpack+TS setup, but discovered that webpack watch mode time grows linearly with the number of files. I found this extremely discouraging and didn't do any further tests/investigation.
@Kavorka79, could you try running tsc --watch and see if it has better performance? (and, while we are at it, also try the tsc --incremental). This way we could know if there is still hope to fix something in the plugin.
There is a related issue in TypeScript repo: https://github.com/microsoft/TypeScript/issues/34119
If you have a problem with slow initial build with useTypescriptIncrementalApi, please run tsc (with watch mode and without with --diagnostics) independently and post the results in the issue. The more information we will give to the developers of TS the sooner they will resolve the issue.
@Kavorka79 , @IIIristraM
Please try fork-ts-checker-webpack-plugin@alpha - I've published a new version which should resolve this issue 馃殌
I will close this issue to clean-up the backlog. If this release didn't solve the issue, we can re-open this :)
Most helpful comment
Just FYI, I was recently trying to get some performance measurements for webpack+TS setup, but discovered that webpack watch mode time grows linearly with the number of files. I found this extremely discouraging and didn't do any further tests/investigation.
@Kavorka79, could you try running
tsc --watchand see if it has better performance? (and, while we are at it, also try thetsc --incremental). This way we could know if there is still hope to fix something in the plugin.