Stas,

Moreover, since this replaces a simple hash lookup with additional two
> function calls (and also other operations included in those) everywhere
> in the engine, it will also have performance impact of one of the most
> frequently used operations in the engine - function calls - while
> providing absolutely no benefit for 100% of existing code and 99.99% of
> future code.
>

This was already directly covered in the RFC already:
https://wiki.php.net/rfc/function_autoloading#c_api_backwards_compatibility

Basically, two new macros are introduced which expand directly to hash
lookups.

#define ZEND_LOOKUP_FUNCTION_BY_NAME(name, name_length, fbc)
(zend_hash_find(EG(function_table), (name), (name_length) + 1,
(void**) (fbc)) == SUCCESS || zend_lookup_function((name),
(name_length), (fbc)) == SUCCESS)

So nothing changes from present (at all) unless a function is not defined.
Today, that's an error case. So the only performance change occurs if
zend_hash_find (which is already there) returns FAILURE. THEN the logic
which includes autoloading would run.

So no, there should be no performance impact at all to existing code thanks
to operator short circuiting.

Anthony

Reply via email to