Skip to content

Generated arginfo header files: use known strings for prop names when… #15751

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

Merged
merged 6 commits into from
Sep 30, 2024

Conversation

DanielEScherzer
Copy link
Member

… possible

Instead of allocating, using, and then releasing a zend_string for every property name unconditionally, only do so when the minimum supported version of PHP does not have that string in its known strings (ZEND_KNOWN_STRINGS). If the string is already known, just use the known version directly. This is already done for some non-generated class registrations, e.g. in zend_enum_register_props().

… possible

Instead of allocating, using, and then releasing a zend_string for every
property name unconditionally, only do so when the minimum supported version of
PHP does not have that string in its known strings (ZEND_KNOWN_STRINGS). If the
string is already known, just use the known version directly. This is already
done for some non-generated class registrations, e.g. in
`zend_enum_register_props()`.
@DanielEScherzer
Copy link
Member Author

Yeah, to be clear, I like the idea, it's clever, however I am not a fan of updating/adding known strings at two places instead of just one. I'd say that let's wait for the opinion of other reviewers!

@kocsismate would you mind taking another look? No objections from other reviewers.

@kocsismate
Copy link
Member

would you mind taking another look? No objections from other reviewers.

Sorry for the delay... But I've rechecked it. I'll approve it once the comments are addressed.

Drop spaces from brackets, don't hard code latest version
@DanielEScherzer
Copy link
Member Author

would you mind taking another look? No objections from other reviewers.

Sorry for the delay... But I've rechecked it. I'll approve it once the comments are addressed.

No worries, comments have been addressed

@DanielEScherzer
Copy link
Member Author

@kocsismate I see that you approved this patch - would you mind also merging it? I don't have the permissions to do so myself

@kocsismate kocsismate merged commit 7a8b1f6 into php:master Sep 30, 2024
9 of 10 checks passed
@DanielEScherzer DanielEScherzer deleted the known-strings branch September 30, 2024 11:30
@staabm
Copy link
Contributor

staabm commented Sep 30, 2024

do we expect a measurable memory optimization from this PR? If so, any approximation?

@kocsismate
Copy link
Member

do we expect a measurable memory optimization from this PR? If so, any approximation?

I was wondering about the same question first (#15751 (comment)), and my estimation is that it has negligible improvements.

jorgsowa pushed a commit to jorgsowa/php-src that referenced this pull request Oct 1, 2024
php#15751)

Instead of allocating, using, and then releasing a zend_string for every
property name unconditionally, only do so when the minimum supported version of
PHP does not have that string in its known strings (ZEND_KNOWN_STRINGS). If the
string is already known, just use the known version directly. This is already
done for some non-generated class registrations, e.g. in
`zend_enum_register_props()`.
DanielEScherzer added a commit to DanielEScherzer/php-src that referenced this pull request Feb 13, 2025
kocsismate pushed a commit that referenced this pull request Feb 14, 2025
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.

5 participants