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

Apply native_function_invocation in PHPCS #8218

Open
wants to merge 1 commit into
base: release-3.0
Choose a base branch
from

Conversation

live627
Copy link
Contributor

@live627 live627 commented May 11, 2024

Some built-in functions can be turned into specific opcodes at compile time when the compiler is sure that they will be used (i.e. no namespace fallback is needed). This can have a major performance impact when they appear in hot paths.

@live627 live627 added the Housekeeping SMF code reorganization label May 11, 2024
@tyrsson
Copy link
Collaborator

tyrsson commented May 11, 2024

use function is_array;

@tyrsson
Copy link
Collaborator

tyrsson commented May 16, 2024

I setup and ran a benchmark on this. Now granted its not using SMF code because I set it up in a repo I had at hand and really that's irrelevant. The sample size is small but even with the low number of revs and its a benefit can be seen.

Results can be found here:
https://gist.github.com/Tyrsson/138566046b96576707afd719cd09ed81

Some built-in functions can be turned into specific opcodes at compile time when the compiler is sure that they will be used (i.e. no namespace fallback is needed). This can have a major performance impact when they appear in hot paths.
@live627
Copy link
Contributor Author

live627 commented Jul 23, 2024

  • existing calls to built in classes are prefixed with the backslah, so this commit follows that pattern
  • I didn't find an option to change this fixer's behavior, and there is no way that I'll do any of this by hand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Housekeeping SMF code reorganization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants