Skip to content
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 use of PreviousConnectingVisitor:: ATTRIBUTE_PARENT to assist garbage collector #670

Closed
wants to merge 1 commit into from

Conversation

staabm
Copy link
Owner

@staabm staabm commented Aug 3, 2024

idea is to have less Ast\Nodes with a pointer to the parent node, so the garbage collector has a easier job identifying unused nodes and clear memory. for our use-case its enough to know parents within functions/method bodies.

refs #667


in the long run it would be best to get rid of PreviousConnectingVisitor but I am currently not deep enough into the details of this lib todo such refactoring right now

@staabm staabm changed the title Reduce use of PreviousConnectingVisitor:: ATTRIBUTE_PARENT Reduce use of PreviousConnectingVisitor:: ATTRIBUTE_PARENT to reduce memory consumption Aug 3, 2024
@staabm staabm changed the title Reduce use of PreviousConnectingVisitor:: ATTRIBUTE_PARENT to reduce memory consumption Reduce use of PreviousConnectingVisitor:: ATTRIBUTE_PARENT to assist garbage collector Aug 3, 2024
@glaubinix
Copy link

Thank you for looking into this already. I run latest stable and this branch with GC enabled and disabled. Looks like there is a slight improvement when gc is disabled. Unfortunately, the regular run got a lot worse.

php ./bin/phpstan php -d zend.enable_gc=0 ./bin/phpstan
0.2.8.1 9:04.60 3:01.07
less-parents 13:31.71 2:57.27

All good if there is no easy solution available at the moment. We can disable gc in our CI build for now. If you ever need to let me run anything then just let me know!

@staabm staabm closed this Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants