SMF icon indicating copy to clipboard operation
SMF copied to clipboard

Apply native_function_invocation in PHPCS

Open live627 opened this issue 9 months ago • 3 comments

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 avatar May 11 '24 05:05 live627

use function is_array;

tyrsson avatar May 11 '24 13:05 tyrsson

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

tyrsson avatar May 16 '24 18:05 tyrsson

  • 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

live627 avatar Jul 23 '24 08:07 live627