Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript watcher consumes large amount of CPU when idle. #17506

Closed
MicahZoltu opened this issue Jul 29, 2017 · 2 comments
Closed

TypeScript watcher consumes large amount of CPU when idle. #17506

MicahZoltu opened this issue Jul 29, 2017 · 2 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@MicahZoltu
Copy link
Contributor

TypeScript Version: 2.4.2

Expected behavior:
When I am not touching any files in my project, TSC with watch: true configured will not consume much (if any) CPU.

Actual behavior:
When I am not touching any files in my project, TSC with watch: true configured consumes a notable amount of CPU on my laptop, enough to keep the fan on consistently.

This blog post suggests that the culprit is a recent change to polling for changes.

Notes:
I am using VSCode with the built-in TypeScript support, the default TypeScript build task and a tsconfig.json like:

{
	"compilerOptions": {
		"target": "es2017",
		"module": "commonjs",
		"sourceMap": true,
		"outDir": "output",
		"rootDir": "source",
		"paths": {
			"*": [
				"./typings/*"
			]
		},
		"emitDecoratorMetadata": true,
		"experimentalDecorators": true,
		"strictNullChecks": true,
		"alwaysStrict": true,
		"allowJs": true,
		"watch": true
	}
}
@NigeNigeNige
Copy link

I'm seeing something similar with tsc 2.3.4.

With polling enabled, tsc -w -p takes up 10-15% CPU on our project files.
With polling disabled, the same command uses virtually no CPU if no files are changing.

Windows 10, Core i5.

@mhegazy mhegazy added this to the TypeScript 2.6 milestone Aug 23, 2017
@mhegazy mhegazy added the Bug A bug in TypeScript label Aug 23, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Oct 4, 2017

Should be fixed in #17269. Please give typescript@next a try and let us know if you are still running into issues.

@mhegazy mhegazy closed this as completed Oct 4, 2017
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Oct 4, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants