-
Notifications
You must be signed in to change notification settings - Fork 471
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
CachedParser: use LRU cache #2879
Conversation
You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x. |
did you compare before and after with the lowered capacity? |
Only by seeing what PHPStan reports in -vvv mode. No changes.
PHPStan itself uses lowered capacity (128 instead of default 256) and that is what I tested (results above). I did not do any tests on our huge codebase yet. |
Yeah… my point was more about: in case we can reduce the capacity of the cache with this PR, it might be useful because even if it is equal fast, it might save memory |
{ | ||
|
||
/** @var array<string, TValue> */ | ||
private array $cache; |
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.
it might make sense to try SplFixedArray here
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.
Hmm our capacity is too small for it beeing useful
After all, it seems like time & cache-miss & memory difference is very small. So the only benefit of this MR might be the code readability & test improvement. I can replace the LRUCache with old logic. Would you merge it after that @ondrejmirtes? Or just close it. |
Yeah, I don't think this fixes a real problem :) |
No description provided.