PHP_CodeSniffer
PHP_CodeSniffer copied to clipboard
Caching on Windows makes CS check incredibly slow
Describe the bug
I've done some - not entirely scientific - benchmark checks and am finding that enabling the caching option when on Windows (not sure about other OSes), makes a CS run significantly slower.
For a CS run with a custom ruleset and the following command over 57 files:
phpcs ./inc/ --sniffs=Squiz.Commenting.FunctionComment,Universal.Operators.StrictComparisons,Generic.CodeAnalysis.EmptyPHPStatement,PHPCompatibility.ParameterValues.NewHTMLEntitiesFlagsDefault,PSR12.Files.FileHeader,Squiz.Commenting.InlineComment,WordPress.WP.PostsPerPage
These are the approximate timings I'm seeing:
Checked against | Time with cache ON | Time without cache OFF (--no-cache ) |
---|---|---|
master |
Time: 3 mins, 5.61 secs; Memory: 78MB | Time: 3.7 secs; Memory: 36MB |
Expected behavior I would expect a little bit of a slow-down the first time PHPCS is run with cache turned on as the cache file needs to be written, but the slow-down I'm seeing now is out of bounds.
Versions (please complete the following information):
- OS: Windows 10
- PHP: 8.1.2
- PHPCS:
master
, but also checked3.6.2
tag - Standard: custom
Additional context
I haven't done a git bisect
yet to figure out if I can pinpoint the slow-down to a specific commit, but felt that the time difference is so huge and on the negative for having caching turned on, this had to be reported forthwith.