{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/19762","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/19762/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/19762/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/19762/events","html_url":"https://github.com/Microsoft/TypeScript/issues/19762","id":271426084,"number":19762,"title":"High CPU when using --watch on 2000+ files (roughly 40megs)","user":{"login":"eyalellenbogen","id":5967992,"avatar_url":"https://avatars3.githubusercontent.com/u/5967992?v=4","gravatar_id":"","url":"https://api.github.com/users/eyalellenbogen","html_url":"https://github.com/eyalellenbogen","followers_url":"https://api.github.com/users/eyalellenbogen/followers","following_url":"https://api.github.com/users/eyalellenbogen/following{/other_user}","gists_url":"https://api.github.com/users/eyalellenbogen/gists{/gist_id}","starred_url":"https://api.github.com/users/eyalellenbogen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eyalellenbogen/subscriptions","organizations_url":"https://api.github.com/users/eyalellenbogen/orgs","repos_url":"https://api.github.com/users/eyalellenbogen/repos","events_url":"https://api.github.com/users/eyalellenbogen/events{/privacy}","received_events_url":"https://api.github.com/users/eyalellenbogen/received_events","type":"User","site_admin":false},"labels":[{"id":113971304,"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Needs%20More%20Info","name":"Needs More Info","color":"556b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-11-06T10:29:05Z","updated_at":"2017-11-26T18:14:07Z","closed_at":null,"author_association":"NONE","body":"**Code**\r\n```ts\r\ntsc -w\r\n```\r\n**TypeScript version:**\r\n2.6.1 (reproduces in previous versions as well)\r\n\r\n**Expected behavior:**\r\nTo not hog CPU when watching (not while compiling).\r\n\r\n**Actual behavior:**\r\n`tsc` node process occupies 30-40% CPU while idle in watch. \r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/347027488","html_url":"https://github.com/Microsoft/TypeScript/issues/19762#issuecomment-347027488","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/19762","id":347027488,"user":{"login":"OlekNg","id":785741,"avatar_url":"https://avatars2.githubusercontent.com/u/785741?v=4","gravatar_id":"","url":"https://api.github.com/users/OlekNg","html_url":"https://github.com/OlekNg","followers_url":"https://api.github.com/users/OlekNg/followers","following_url":"https://api.github.com/users/OlekNg/following{/other_user}","gists_url":"https://api.github.com/users/OlekNg/gists{/gist_id}","starred_url":"https://api.github.com/users/OlekNg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlekNg/subscriptions","organizations_url":"https://api.github.com/users/OlekNg/orgs","repos_url":"https://api.github.com/users/OlekNg/repos","events_url":"https://api.github.com/users/OlekNg/events{/privacy}","received_events_url":"https://api.github.com/users/OlekNg/received_events","type":"User","site_admin":false},"created_at":"2017-11-26T18:14:06Z","updated_at":"2017-11-26T18:14:06Z","author_association":"NONE","body":"I'm also experiencing this issue.\r\nMachine i7 3632qm 12GB ram, SSD.\r\n\r\nProject has almost 2000 ts files, and compiling in watch mode uses about 6-7% CPU constantly when waiting on changes:\r\n18:59:26 - Compilation complete. Watching for file changes.\r\nUnfortunately I cannot share project source, because it's closed software of my company.\r\n\r\nI've seen similar issue when using grunt-watch task, which uses pooling to detect file changes. It's good for small projects but it's starting to stress cpu just watching hundreds of files. We switched to our custom implementation of watch using node fs.watch, which uses \"native\" host os watching for changes feature which is much more efficient with cpu than pooling (and much faster).\r\nIsn't that the case? I couldn't find info about what typescipt compiler uses internally for watching changes."}}
{"actor":{"display_login":"OlekNg"}}