-
Couldn't load subscription status.
- Fork 544
use a separate resultCache per project config file #1469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Command/AnalyseApplication.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while thinking about the idea suggested in phpstan/phpstan#7379 (comment) I came to this - in my eyes - even simpler solution to the problem.
instead of fiddling with all the different path-types involved we just use a separate resultCache-name per project-configuration file.
tbh the solutions seems to be to simple, so I think it might have some serious problems somewhere ;-).
(削除) in case we can proceed with this idea, I would check the current build errors and see how to actually test this change... (削除ここまで) at least the local testing on my project suggests that it is now using the result-cache where it didn't before.. so it seems to solve my problem at hand.
any feedback is welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The $resultCacheName parameter of restore method shouldn't be misused for this, its usage is reserved only for PHPStan Pro purposes. It puts the result cache file in a subdirectory, I don't want to complicate it like that.
But hey - the logic you're doing here depends on $projectConfigArray and that is entirely available in restore() method too, so you can do the logic based on that there. A lot of useful values that can be used in the hash computation logic are already in the constructor/can be asked for there so I think this idea has wings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjusted per feedack and manually tested locally.
do we need a automatic test for the case? if so where and what to test (might be a bit hard because of random file-names involved)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw: in the docs there is no resultCachePath mentioned.. should it be added?
src/Command/AnalyseApplication.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The $resultCacheName parameter of restore method shouldn't be misused for this, its usage is reserved only for PHPStan Pro purposes. It puts the result cache file in a subdirectory, I don't want to complicate it like that.
But hey - the logic you're doing here depends on $projectConfigArray and that is entirely available in restore() method too, so you can do the logic based on that there. A lot of useful values that can be used in the hash computation logic are already in the constructor/can be asked for there so I think this idea has wings.
c6d5ecf to
d6af959
Compare
fff3d06 to
b235560
Compare
b235560 to
1f38eba
Compare
1f38eba to
7ae6a7e
Compare
2c1a994 to
90d9217
Compare
c8658a0 to
67e8c4b
Compare
67e8c4b to
b6dda79
Compare
b6dda79 to
3d85276
Compare
3af7989 to
3c8cace
Compare
ea060a9 to
c711f0d
Compare
c711f0d to
7bebfdf
Compare
added a test-case. should be good to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since checking exactly which hashes are generated is a bit too much IMO, I just verified phpstan will create result-cache files including some suffix (aka. the hash), which it did not do before this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tmpDir case is already covered by an existing test which uses a tmpDir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this condition is covered by #1475
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only thing I am not 100% sure: what needs to be here in this hash.
maybe just the $this->analysedPaths are already enough, since these are the absolute paths within the system..?
286d1f6 to
3ac86ba
Compare
@ondrejmirtes anything I can do to get this merged?
3ac86ba to
7ff840b
Compare
b69949f to
5511155
Compare
46831b1 to
9e98a7e
Compare
9e98a7e to
e24b20e
Compare
I'm looking forward to this feature too. I should be able to get rid of some local config entries most likely :)
sorry, for the "bump", but I just thought about this PR and was wondering about its state and/or if it was forgotten maybe :)
I'm a bit afraid to touch this area because it's hard to test it.
Uh oh!
There was an error while loading. Please reload this page.
closes phpstan/phpstan#7379
closes phpstan/phpstan#7601
With this patch we see analysis time dropped to ~5 seconds from previous 2-3 minutes in mono-repo projects, which contain several phpstan.neon files.