-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Arginfo: avoid using temporary zvals for initializing attribute values #19141
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
base: master
Are you sure you want to change the base?
Conversation
This is the second part of my follow-up to #18780 (after #19075) dealing with reducing the work of registering attributes on constants (and other things)
Yes I agree. Originally posted by @nielsdos in #18780 (comment) |
Instead of * adding a zval on the stack * initializing it * copying the value to the attribute Just initialize the value directly in the zend_attribute_arg
2c509e9
to
bc43982
Compare
Comparing the benchmarking results with those from the most recent prior commit that ran CI (a22dc67) (differences in bold)
So everything but |
The difference you're observing can be attributed to noise. Anything around 0.01% difference is too small to say anything useful about. Intuitively, this patch shouldn't make things worse. |
Okay, in that case I plan to merge this in a few days if there are no objections (CC @kocsismate) |
$forStringDef = "{$zvalName}_str"; | ||
} | ||
$code .= "\tzend_string *$forStringDef = zend_string_init($cExpr, strlen($cExpr), 1);\n"; | ||
$code .= "\tZVAL_STR(&$zvalName, $forStringDef);\n"; |
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.
I suppose this can even be ZVAL_NEW_STR as they're not interned.
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.
Similarly, all strings that are coming from KNOWN_STRINGS can be set via ZVAL_INTERNED_STR
Instead of
Just initialize the value directly in the zend_attribute_arg