summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyson Andre <tysonandre775@hotmail.com>2020-01-19 13:44:13 -0500
committerTyson Andre <tysonandre775@hotmail.com>2020-01-20 09:54:04 -0500
commit691880b22c1ebdf7b58a25e599d2ba41c72b1dfa (patch)
tree826bcf239b0f0555ce83e57d944bc4c2eb406f18
parent0fbdc5a378588846ff1d0f4162af2e83c8578842 (diff)
downloadphp-git-691880b22c1ebdf7b58a25e599d2ba41c72b1dfa.tar.gz
Speed up unserializing object properties
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
-rw-r--r--ext/standard/var_unserializer.re5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index feaccb2a50..c395f3cb5c 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -559,10 +559,13 @@ string_key:
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