Hi,

there are some questions whether PR #3360 (Implement ZEND_ARRAY_KEY_EXISTS
opcode to speed up array_key_exists()) [1] could go into 7.3.0beta2 or not.

This PR adds new opcode, but also significantly improves performance of
array_key_exists(), to the point that it becomes faster than isset(). This
function
is often used in major OSS libraries and some of them use hacks with
pre-checking
using isset() to avoid the performance overhead of calling this PHP
function.

Language-wise it's similar to ZEND_COUNT or ZEND_IN_ARRAY - only a specific
instruction with a VM handler to eliminate the function calling overhead.
This new opcode may have some implications for extensions, though quickly
grepping
trough XDebug and PHPDBG source didn't reveal any specific handling for
ZEND_COUNT or ZEND_IN_ARRAY.

Do you think this optimization could still go into 7.3 so the PHP ecosystem
could benefit from this improvement (possibly could be reverted in case of
issues)?
Or does it have to wait for 16 months?

Thanks,
M.

[1] https://github.com/php/php-src/pull/3360

Reply via email to