-
Notifications
You must be signed in to change notification settings - Fork 131
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
Reduce memory footprint of PhpStormStubsSourceStubber
and MemoizingParser
#627
Conversation
Still more than double than before I guess :( @Ocramius is right that this should be supported but if I had to choose between:
...it's obvious what I'd choose :) |
The rest of the memory usage is probably not related to case insensitive constants. PR builds: https://github.com/Roave/BetterReflection/actions?query=branch%3Aphpstorm-stubber Current PR uses static properties again and it decreased from 2.31 GB to 1.38 GB: https://github.com/Roave/BetterReflection/pull/627/checks?check_run_id=718176772 I've tried revert of case insensitive constants just to test it and it's even worse - 1.85 GB: https://github.com/Roave/BetterReflection/pull/628/checks?check_run_id=718188887 |
1.41 GB - Already contains case insensitive constants. After #606 has been merged: 2.55 GB So it looks it's something in #606. |
Can you try reverting my changes to the memoizing source locator? Maybe
that had a bigger impact than expected.
…On Thu, May 28, 2020, 22:41 Jaroslav Hanslík ***@***.***> wrote:
1.41 GB - Already contains case insensitive constants.
https://github.com/Roave/BetterReflection/runs/717048810?check_suite_focus=true
After #606 <#606> has been
merged: 2.55 GB
https://github.com/Roave/BetterReflection/runs/717069119?check_suite_focus=true
So it looks it's something in #606
<#606>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#627 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABFVECCLPT63FUDAPZURHLRT3D75ANCNFSM4NNLKA7A>
.
|
@Ocramius Tested just now. It decresed to 178.00 MB (this PR + the revert). Probably problems with serialize/unserialize. |
It also faster: 12 seconds vs 18 seconds on my ntb |
Yeh, strings are heavy. We can run with the revert, but I'll need to also ensure that a few of the tests run in a separate process. Also unsure about reverting the constraint that guarantees distinct AST nodes... |
BTW what we did in CachedParser in PHPStan (same concept as Memoizing) some time ago is that we don't keep all cached keys in memory at once. There's an upper limit and keys get evicted when newer ones appear. Surprisingly this has minimal performance impact, but memory footprint is smaller. See: https://github.com/phpstan/phpstan-src/blob/master/src/Parser/CachedParser.php |
Funny realization for me - there's zero memory impact if I use |
62a6d3c
to
7a5fe50
Compare
I've improved the memory usage with |
3e4d4e3
to
a647ea5
Compare
The solution here is not optimal (it's a little ugly) but has better memory usage than |
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.
LGTM 👍
PhpStormStubsSourceStubber
and MemoizingParser
Thanks @kukulich! |
Fixes #624