You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When it is activated, under Windows, it often leads to timeouts, especially if one has bigger and/or many projects.
An error message will be displayed:PHP Mess Detector phpmd: Can not correctly run the tool with parameters.
I found out the cause of this is the PDepend's cache folder being too large, thus leading to increased execution time which will go beyond the configured timeout threshold setting (up to 30 seconds) in PhpStorm.
PHPMD & PDepend have a long history of various issues with its caching mechanism (in no particular order):
If a file named pdepend.xml or pdepend.xml.dist exists in the current working directory where you run phpmd, then you can configure pdepend as you like.
On the other side, for a big project with 8405 analyzed files in our Jenkins environment PDepend got three times slower and used over 7 times more memory:
With file cache
Time: 0:00:33; Memory: 60.00Mb
With memory cache:
Time: 0:01:31; Memory: 430.00Mb
Unfortunately, I do not have a comparison for PHPMD on this project.
Windows 7, PHP 7.1.x, PHPMD 2.8.1 & PDepend 2.7.1 (composer)
In PhpStorm, for example 2019.3, PHPMD can be configured as one of its "Quality Tools", e.g. through being a Composer dependency.
When it is activated, under Windows, it often leads to timeouts, especially if one has bigger and/or many projects.
An error message will be displayed:
PHP Mess Detector phpmd: Can not correctly run the tool with parameters
.I found out the cause of this is the PDepend's cache folder being too large, thus leading to increased execution time which will go beyond the configured timeout threshold setting (up to 30 seconds) in PhpStorm.
PHPMD & PDepend have a long history of various issues with its caching mechanism (in no particular order):
#184
#52
#90
#29
pdepend/pdepend#447
pdepend/pdepend#307
pdepend/pdepend#465
pdepend/pdepend#193
pdepend/pdepend#181
pdepend/pdepend#90
pdepend/pdepend#87
pdepend/pdepend#94
pdepend/pdepend#19
Comments on the following three issues helped me find the cause of & the solution to my issue:
pdepend/pdepend#307
#94 (comment)
#29 (comment)
Documented on https://github.com/pdepend/pdepend/blob/2.7.1/src/site/rst/documentation/handbook/configuration/index.rst#cache
After doing so, I ran some benchmark by analyzing a small to medium sized project.
Using file cache (no pdepend.xml.dist):
Cache size: 2'974 files, 303 folders, 168 MB RAM
Cache size: 2'974 files, 303 folders, 168 MB RAM
Using memory cache (set through pdepend.xml.dist):
Memory Cache is (unsurprisingly) faster, uses ~1.5 times the RAM compared to file cache, if the cache already exists.
Both start around 23-25 MB RAM.
Using the memroy cache also improved the performance of PHPMD & PDepend in our local Jenkins environment.
This leads me two two questions:
Also, we might want to consider that there are at least two main scenarios for caching in PHPMD/PDepend:
These two scenarios are so different that in 1. a cache might make sense, but in 2. it very likely does not.
The text was updated successfully, but these errors were encountered: