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

Simplify a do…while loop into a for one #13981

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jvoisin
Copy link
Contributor

@jvoisin jvoisin commented Apr 16, 2024

No description provided.

Zend/zend_alloc.c Outdated Show resolved Hide resolved
Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop was especially optimized for performance.
It doesn't make sense to change it without a real reason.

@jvoisin
Copy link
Contributor Author

jvoisin commented Apr 17, 2024

Readability? PHP's heap management code is complicated enough as it is without having contortions like his. The last time this code was touched, it was 10 years ago (by you). I do hope that compilers got better at improving trivial loops in the meantime.

@iluuu1994
Copy link
Member

Optimizers work based on heuristics. It's really not possible to know whether some optimization is beneficial or detrimental without testing. Can you test whether this changes performance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants