Uh oh!
There was an error while loading. Please reload this page.
add details about optimizer passes - #4858
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
realFlowControl
left a comment
There was a problem hiding this comment.
There are really just a few external links in the docs, would you think it would be beneficial to link to Nikitas blog post?
As there are only a few external links, I am not sure how this is handled usually
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
arnaud-lb
left a comment
There was a problem hiding this comment.
This looks good to me, but I will defer to doc maintainers for the final review.
I think that linking to the blog post would make sense, as it can be considered a reference, but I'm not sure about the policy either. I also defer to doc maintainers.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Girgias
left a comment
There was a problem hiding this comment.
Please try to use <simpara> for new text as PhD generates an HTML <p> tag rather than a <div> as <para> does.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
realFlowControl
commented
Jan 15, 2026
Thanks @Girgias for your review, I've applied your suggestions |
Girgias
commented
Jan 19, 2026
@realFlowControl can you rebase the PR as I performed some bulk XML changes on |
f93864b to
fac85fbComparerealFlowControl
commented
Jan 19, 2026
@Girgias rebase ✅ |
Uh oh!
There was an error while loading. Please reload this page.
| </listitem> | ||
| <listitem> | ||
| <simpara> | ||
| <emphasis>Bit 16</emphasis>: Ignoring operator overloading |
There was a problem hiding this comment.
Does it ignore only overloding from do_operation or also comparison overloading?
There was a problem hiding this comment.
AFAIK it is only about the binary and unary operators (so the do_operation you mentioned), more specifically about tracking a MAY_BE_OBJECT (and MAY_BE_FALSE) for the result of that operation to unlock optimisation further down, see https://github.com/php/php-src/blob/aeb8524584967bdebffec0e7896ca358a8071f3e/Zend/Optimizer/zend_inference.c#L2267-L2274
For comparison the result is always a boolean (or int for the spaceship operator), it can't be an object, so this does not apply.
There was a problem hiding this comment.
Right, I guess it would be good to indicate that this only affects classes overloading the do_operator object handle, as many more internal classes overload the compare object handler (e.g. ext/data) and if someone doesn't use ext/gmp, ext/bcmatch enabling this optimization might be sensible.
There was a problem hiding this comment.
Oh yes, that is good idea, documenting the "unsafe" bit and when/why it is safe. I'll have a look and add this
There was a problem hiding this comment.
I've added docs and an example on the unsafe optimisations
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Uh oh!
There was an error while loading. Please reload this page.
Girgias
commented
Jan 24, 2026
Sorry this took a while. Should be live within a few hours! :) |
And expand on what the unsafe optimizations do and when they could potentially be applied. Co-authored-by: Gina Peter Banyard <girgias@php.net>
Did some digging into optimizer passes in php/php-src#19658 and figured I could just document things a bit more user friendly