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 array_any(), array_all(), array_find(), array_find_key() #17978

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

nielsdos
Copy link
Member

@nielsdos nielsdos commented Mar 5, 2025

By returning something more semantically meaningful that SUCCESS/FAILURE we can avoid refcounting for array_all() and array_any(). Also we can avoid resetting the input values to UNDEF.

Benchmarks didn't really indicate a notable performance change, I got ~1% but that might be noise too. The motivation for this PR is simplification, not necessarily performance.

By returning something more semantically meaningful that SUCCESS/FAILURE
we can avoid refcounting for array_all() and array_any().
Also we can avoid resetting the input values to UNDEF.
@nielsdos nielsdos marked this pull request as ready for review March 5, 2025 19:49
@nielsdos nielsdos requested a review from bukka as a code owner March 5, 2025 19:49
@nielsdos nielsdos requested a review from Girgias March 5, 2025 19:49
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

This is a nice simplification indeed. Thank you!

@nielsdos nielsdos merged commit 9ddc25a into php:master Mar 6, 2025
9 checks passed
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