-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Domain: PerformanceReports of unusually slow behaviorReports of unusually slow behaviorDomain: tsc -bIssues related to build modeIssues related to build modeFix AvailableA PR has been opened for this issueA PR has been opened for this issueFixedA PR has been merged for this issueA PR has been merged for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
Bug Report
In a monorepo with composite projects, adding -b
slows down the --watch
mode reaction time, even when tsc -b --watch
is run inside some packages/shared/
project which has 0 references in its tsconfig.json. The compilation time is like 3.4s vs. 0.3s when used without -b on a small sub-project, and is way higher for large projects (or even when tsc -b --watch
is executed in the root).
In both of these cases, tsBuildInfoFile is utilized (and successfully updated).
🔎 Search Terms
tsc watch build slow
I found #42960, but not sure it's about the same topic: it says nothing about --build and non-build modes.
🕗 Version & Regression Information
@next 4.4.0-dev.20210716
💻 Code
$ tsc -b --watch --extendedDiagnostics # SLOW
FileWatcher:: Triggered with ...AssetType.ts 1:: WatchInfo: ... Elapsed:: 0.9445369839668274ms ...
[8:20:21 PM] File change detected. Starting incremental compilation...
Files: 1014
Lines of Library: 27948
Lines of Definitions: 205178
Lines of TypeScript: 15524
Lines of JavaScript: 63
Lines of JSON: 0
Lines of Other: 0
Nodes of Library: 119542
Nodes of Definitions: 701795
Nodes of TypeScript: 53084
Nodes of JavaScript: 286
Nodes of JSON: 0
Nodes of Other: 0
Identifiers: 297572
Symbols: 183176
Types: 1262
Instantiations: 193
Memory used: 293087K
Assignability cache size: 174
Identity cache size: 6
Subtype cache size: 42
Strict subtype cache size: 0
I/O Read time: 0.10s
Parse time: 1.60s
ResolveModule time: 0.34s
ResolveTypeReference time: 0.11s
Program time: 2.39s
Bind time: 0.85s
Check time: 0.09s
transformTime time: 0.03s
commentTime time: 0.01s
printTime time: 0.15s
Emit time: 0.15s
Source Map time: 0.01s
I/O Write time: 0.00s
Total time: 3.48s
[8:20:25 PM] Found 0 errors. Watching for file changes.
$ tsc --watch --extendedDiagnostics # FAST
FileWatcher:: Triggered with .../AssetType.ts ... Elapsed:: 0.6002329587936401ms ...
[8:21:50 PM] File change detected. Starting incremental compilation...
Synchronizing program
CreatingProgramWith::
roots: [".../AppPaywall.ts",".../AppRoutes.ts",...lots of other paths here]
options: {"composite":true,"incremental":true,"allowJs":true,"skipLibCheck":true,"jsx":2,"module":1,"removeComments":false,"moduleResolution":2,"experimentalDecorators":true,"pretty":true,"noErrorTruncation":true,"resolveJsonModule":true,"sourceMap":true,"declaration":true,"declarationMap":true,"target":6,"esModuleInterop":true,"noImplicitReturns":true,"strict":true,"typeRoots":[".../node_modules/@types",".../packages/shared/@types"],"tsBuildInfoFile":".../packages/shared/dist.tsc/tsconfig.tsbuildinfo","rootDir":".../packages/shared/src","outDir":".../packages/shared/dist.tsc","paths":{},"lib":["lib.es2019.d.ts","lib.dom.d.ts"],"pathsBasePath":".../packages/shared","watch":true,"extendedDiagnostics":true,"configFilePath":".../packages/shared/tsconfig.json"}
Files: 1014
Lines of Library: 27948
Lines of Definitions: 205178
Lines of TypeScript: 15524
Lines of JavaScript: 63
Lines of JSON: 0
Lines of Other: 0
Nodes of Library: 119542
Nodes of Definitions: 701795
Nodes of TypeScript: 53079
Nodes of JavaScript: 286
Nodes of JSON: 0
Nodes of Other: 0
Identifiers: 297571
Symbols: 183175
Types: 1260
Instantiations: 193
Memory used: 290998K
Assignability cache size: 174
Identity cache size: 6
Subtype cache size: 42
Strict subtype cache size: 0
I/O Read time: 0.00s
Parse time: 0.01s
ResolveModule time: 0.00s
Program time: 0.03s
Bind time: 0.01s
Check time: 0.12s
transformTime time: 0.04s
commentTime time: 0.01s
printTime time: 0.17s
Emit time: 0.18s
Source Map time: 0.01s
I/O Write time: 0.00s
Total time: 0.33s
[8:21:51 PM] Found 0 errors. Watching for file changes.
🙁 Actual behavior
tsc -b --watch
compiles a single changed file way slower than tsc --watch
.
🙂 Expected behavior
They work at comparable speeds.
$ cat packages/shared/tsconfig.json
{
"extends": "../../tsconfig.base.json",
"include": [
"src/**/*"
],
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "dist.tsc/tsconfig.tsbuildinfo",
"rootDir": "src",
"outDir": "dist.tsc",
"paths": {},
"module": "commonjs",
"lib": [
"es2019",
"DOM"
],
}
}
$ cat ./tsconfig.base.json
{
"compilerOptions": {
"composite": true,
"incremental": true,
"allowJs": true,
"skipLibCheck": true,
"jsx": "react",
"module": "esnext",
"removeComments": false,
"moduleResolution": "node",
"experimentalDecorators": true,
"pretty": true,
"noErrorTruncation": true,
"resolveJsonModule": true,
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"target": "es2019",
"esModuleInterop": true,
"noImplicitReturns": true,
"strict": true,
"typeRoots": [
"./node_modules/@types",
"./packages/shared/@types"
]
},
}
sledorze, jzimmek, zofiag and deftomat
Metadata
Metadata
Assignees
Labels
Domain: PerformanceReports of unusually slow behaviorReports of unusually slow behaviorDomain: tsc -bIssues related to build modeIssues related to build modeFix AvailableA PR has been opened for this issueA PR has been opened for this issueFixedA PR has been merged for this issueA PR has been merged for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone