Hash table lookups are slow.
Don't do one a second time to update the property.
The call to zend_hash_update_ind goes back to
8b0deb8cd2d
Background: Properties are IS_INDIRECT when they're a declared property,
and point to properties_table.
See https://nikic.github.io/2015/06/19/Internal-value-representation-in-PHP-7-part-2.html#objects-in-php-7
if ((old_data = zend_hash_find(ht, Z_STR(key))) != NULL) {
if (Z_TYPE_P(old_data) == IS_INDIRECT) {
+ /* This is a property with a declaration */
old_data = Z_INDIRECT_P(old_data);
info = zend_get_typed_property_info_for_slot(obj, old_data);
var_push_dtor(var_hash, old_data);
- data = zend_hash_update_ind(ht, Z_STR(key), &d);
+ Z_TRY_DELREF_P(old_data);
+ ZVAL_COPY_VALUE(old_data, &d);
+ data = old_data;
if (UNEXPECTED(info)) {
/* Remember to which property this slot belongs, so we can add a