]> granicus.if.org Git - php/commitdiff
Speedup array/HashTable copying. (Matt W)
authorDmitry Stogov <dmitry@php.net>
Tue, 3 Oct 2006 11:10:54 +0000 (11:10 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 3 Oct 2006 11:10:54 +0000 (11:10 +0000)
Zend/zend_API.c
Zend/zend_compile.c
Zend/zend_variables.c

index a77447dd3077bfeebfa78d2ca0d3c2ee8632df68..e416e2110d468e074e1eda6a28c1b8e936cdc1bd 100644 (file)
@@ -1221,7 +1221,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
 #else
                        ALLOC_HASHTABLE(class_type->static_members);
 #endif
-                       zend_u_hash_init(CE_STATIC_MEMBERS(class_type), 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode));
+                       zend_u_hash_init(CE_STATIC_MEMBERS(class_type), zend_hash_num_elements(&class_type->default_static_members), NULL, ZVAL_PTR_DTOR, 0, UG(unicode));
 
                        zend_hash_internal_pointer_reset_ex(&class_type->default_static_members, &pos);
                        while (zend_hash_get_current_data_ex(&class_type->default_static_members, (void**)&p, &pos) == SUCCESS) {
@@ -1291,7 +1291,7 @@ ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type
                        object->properties = properties;
                } else {
                        ALLOC_HASHTABLE_REL(object->properties);
-                       zend_u_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode));
+                       zend_u_hash_init(object->properties, zend_hash_num_elements(&class_type->default_properties), NULL, ZVAL_PTR_DTOR, 0, UG(unicode));
                        zend_hash_copy(object->properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
                }
        } else {
index c7472e8444322d29e2262ddcf9124f9636443626..3bf3514144d429f9290a3ef6b5ce4b8920270b95 100644 (file)
@@ -1926,7 +1926,7 @@ ZEND_API void function_add_ref(zend_function *function TSRMLS_DC)
                        zval *tmp_zval;
 
                        ALLOC_HASHTABLE(op_array->static_variables);
-                       zend_u_hash_init(op_array->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0, UG(unicode));
+                       zend_u_hash_init(op_array->static_variables, zend_hash_num_elements(static_variables), NULL, ZVAL_PTR_DTOR, 0, UG(unicode));
                        zend_hash_copy(op_array->static_variables, static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_zval, sizeof(zval *));
                }
        }
index 1f1936950f29ffb810640e99eb9f51789d070955..a929966e37d0076095ca97abdeb85567e34df4bd 100644 (file)
@@ -157,7 +157,7 @@ copy_unicode:
                                        return; /* do nothing */
                                }
                                ALLOC_HASHTABLE_REL(tmp_ht);
-                               zend_u_hash_init(tmp_ht, 0, NULL, ZVAL_PTR_DTOR, 0, original_ht->unicode);
+                               zend_u_hash_init(tmp_ht, zend_hash_num_elements(original_ht), NULL, ZVAL_PTR_DTOR, 0, original_ht->unicode);
                                zend_hash_copy(tmp_ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
                                Z_ARRVAL_P(zvalue) = tmp_ht;
                        }