plantain-00 / type-coverage

A CLI tool to check type coverage for typescript code
MIT License
1.26k stars 44 forks source link

ts-plugin-type-coverage incredible slow #65

Open darky opened 4 years ago

darky commented 4 years ago

When I active it https://github.com/plantain-00/type-coverage#the-typescript-language-service-plugin-of-type-coverageadded-in-v212

My IDE became incredible slow. Each change of code entails CPU usage 100% of tsserver process. Also tsserver eat 1.5GB of memory instead 300Mb like before. Why it happens? Maybe type-coverage do full project check, when trivial change of code in file happens? IDE responsibility on each change of code is 5-10 seconds now. Sorry, it's not useful for development.

crazylive commented 4 years ago

Have the same problem.

Noticed the bundle between TS 4.0.2 and type-coverage 2.13.1 has become much slower, compared to TS 3.7.5 and type-coverage 2.4.2

Unfortunately had to temporarily remove type-coverage after add to project dependency "styled-components". There is not enough ignore for the lib and everything connected with it.

Probably this is another issue...

Please help, i like type-coverage

plantain-00 commented 4 years ago

I will check this issue this weekend, you can disable it by commenting it in "plugins" or disable the plugin. @crazylive I checked the check time on this project, 1.8s with cache for v1.4.2, 2.1s ~ 3s without cache for v2.13.1, it seems not a problem. 屏幕快照 2020-09-17 06 52 34 屏幕快照 2020-09-17 06 52 46 https://travis-ci.org/github/plantain-00/type-coverage/builds/662305606 https://travis-ci.org/github/plantain-00/type-coverage/builds/726738671

crazylive commented 4 years ago

you right, seems it affected from other dependencies, i check it later

plantain-00 commented 4 years ago

I checked, but I cannot reproduce it in my MacBook air.

屏幕快照 2020-09-19 16 32 10

I tried to enable the plugin by set plugins in tsconfig.json compilerOptions, also by install the vscode plugin. The plugin works as expected, and my CPU and memory looks normal. The VScode responsibility on each change of code is less than 0.5 seconds, same as usual.

I checked the code, the plugin just check the current file, not whole project: https://github.com/plantain-00/type-coverage/blob/master/packages/plugin/src/index.ts#L18 https://github.com/plantain-00/type-coverage/blob/master/packages/core/src/core.ts#L176