ikappas / vscode-phpcs

PHP CodeSniffer for Visual Studio Code
MIT License
128 stars 56 forks source link

Extension causes high cpu load #138

Closed iyashpal closed 2 years ago

iyashpal commented 5 years ago

ikappas.phpcs-unresponsive.cpuprofile.txt

:warning: Make sure to attach this file from your home-directory: /home/yashpal/ikappas.phpcs-unresponsive.cpuprofile.txt :warning:

Find more details here: https://github.com/Microsoft/vscode/wiki/Explain:-extension-causes-high-cpu-load

Profile file: ikappas.phpcs-unresponsive.cpuprofile.txt

nunoperalta commented 5 years ago

For some reason, this happens to me for some PHP files... the only way to stop is to close Visual Studio Code and then kill all the "php" processes running on Windows.

I haven't figured out yet what causes this, but it definitely happens more frequently in specific (100% valid) PHP scripts.

nunoperalta commented 5 years ago

Any update on this?

Kwaadpepper commented 5 years ago

I have noticed phpcs check runs for every error in page. I don't know why but i think this extension runs phpcs in a loop and checks only one error at a time.

I think it should run once every save or with a timeout of 5 sec when stop typing for the entire page. It should reduce CPU overload.

nunoperalta commented 5 years ago

@Kwaadpepper I moved to "wongjn.php-sniffer", and I'm very happy with that one.

Config I have:

"phpSniffer.run": "onSave",
"phpSniffer.executablesFolder": "........\\Composer\\vendor\\bin\\",
"phpSniffer.standard": "......\\phpcs.xml",
"phpSniffer.windowsHardkill": true,
"phpSniffer.windowsPhpCli": "php.exe",

They have: ""phpSniffer.windowsHardkill": true,"

Kwaadpepper commented 5 years ago

Hey thanks for the info :)

As for me i'm using https://github.com/shevaua/vscode-phpcs now It's a fork from this one. Annotation 2019-09-13 115913

It has a queue buffer and more options like disable on type check It has way better performances.

nunoperalta commented 5 years ago

Awesome! And I assume that fork fixed the high CPU issue? I'm happy with the one I have now, but good to know there are more options!

Kwaadpepper commented 5 years ago

Well i could not say if it works really well on a low end machine as mine is a powerful one. But it seams to work way faster. And the option to make it run on save only makes it ian ideal and universal option.

Maybe if you have a compatible device for this test you could give it a try and print here your impressions ?

I also use this one because i work with WSL as local web server and with linux tools only.