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

ext/ffi: Various minor refactorings #18176

Merged
merged 7 commits into from
Mar 31, 2025
Merged

ext/ffi: Various minor refactorings #18176

merged 7 commits into from
Mar 31, 2025

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Mar 28, 2025

Commits should be reviewed individually.

@Girgias Girgias marked this pull request as ready for review March 29, 2025 03:45
@Girgias Girgias requested a review from dstogov as a code owner March 29, 2025 03:45
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.

Everything except of zend_string equals APIs looks OK.

zend_ffi_get_func() was especially manually optimized to reduce overhead of calling native functions.

ext/ffi/ffi.c Outdated
if (ZSTR_LEN(name) == sizeof("new") -1
&& (ZSTR_VAL(name)[0] == 'n' || ZSTR_VAL(name)[0] == 'N')
&& (ZSTR_VAL(name)[1] == 'e' || ZSTR_VAL(name)[1] == 'E')
&& (ZSTR_VAL(name)[2] == 'w' || ZSTR_VAL(name)[2] == 'W')) {
if (zend_string_equals_literal_ci(name, "new")) {
Copy link
Member

Choose a reason for hiding this comment

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

zend_string_equals_literal_ci() is going to be slower. I would prefer to revert this.

@Girgias
Copy link
Member Author

Girgias commented Mar 31, 2025

Dropped the zend_strings_equals commit and added another commit to attach your explanation to it. :)

@Girgias Girgias merged commit 5a4c460 into php:master Mar 31, 2025
8 of 9 checks passed
@Girgias Girgias deleted the ffi-refactor branch March 31, 2025 16:03
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.

3 participants