iliaa Sun Nov 12 17:13:23 2006 UTC Modified files: (Branch: PHP_5_2) /php-src NEWS /php-src/ext/standard array.c Log: Optimized array functions utilizing php_splice(). http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.357&r2=1.2027.2.547.2.358&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.357 php-src/NEWS:1.2027.2.547.2.358 --- php-src/NEWS:1.2027.2.547.2.357 Sun Nov 12 01:14:39 2006 +++ php-src/NEWS Sun Nov 12 17:13:22 2006 @@ -15,6 +15,7 @@ - Streams optimization (Dmitry) . removed unnecessary ftell() calls (one call for each included PHP file) . disabled calls to read() after EOF +- Optimized array functions utilizing php_splice(). (Ilia) - VCWD_REALPATH() is improved to use realpath cache without VIRTUAL_DIR. (Dmitry) - ext/bcmath intialization code is moved from request startup to module http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.15&r2=1.308.2.21.2.16&diff_format=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.308.2.21.2.15 php-src/ext/standard/array.c:1.308.2.21.2.16 --- php-src/ext/standard/array.c:1.308.2.21.2.15 Sun Nov 12 01:14:39 2006 +++ php-src/ext/standard/array.c Sun Nov 12 17:13:22 2006 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.308.2.21.2.15 2006/11/12 01:14:39 bjori Exp $ */ +/* $Id: array.c,v 1.308.2.21.2.16 2006/11/12 17:13:22 iliaa Exp $ */ #include "php.h" #include "php_ini.h" @@ -1874,7 +1874,7 @@ /* Update output hash depending on key type */ if (p->nKeyLength) - zend_hash_update(out_hash, p->arKey, p->nKeyLength, &entry, sizeof(zval *), NULL); + zend_hash_quick_update(out_hash, p->arKey, p->nKeyLength, p->h, &entry, sizeof(zval *), NULL); else zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); } @@ -1885,7 +1885,7 @@ entry = *((zval **)p->pData); entry->refcount++; if (p->nKeyLength) - zend_hash_update(*removed, p->arKey, p->nKeyLength, &entry, sizeof(zval *), NULL); + zend_hash_quick_update(*removed, p->arKey, p->nKeyLength, p->h, &entry, sizeof(zval *), NULL); else zend_hash_next_index_insert(*removed, &entry, sizeof(zval *), NULL); } @@ -1897,17 +1897,7 @@ /* ..for each one, create a new zval, copy entry into it and copy it into the output hash */ for (i=0; i<list_count; i++) { entry = *list[i]; - if (entry->refcount>=1000) { - zval *tmp = (zval *) emalloc(sizeof(zval)); - - *tmp = *entry; - zval_copy_ctor(tmp); - tmp->refcount = 1; - tmp->is_ref = 0; - entry = tmp; - } else { - entry->refcount++; - } + entry->refcount++; zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); } } @@ -1917,7 +1907,7 @@ entry = *((zval **)p->pData); entry->refcount++; if (p->nKeyLength) - zend_hash_update(out_hash, p->arKey, p->nKeyLength, &entry, sizeof(zval *), NULL); + zend_hash_quick_update(out_hash, p->arKey, p->nKeyLength, p->h, &entry, sizeof(zval *), NULL); else zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); } @@ -2212,7 +2202,7 @@ /* Get the arguments and do error-checking */ argc = ZEND_NUM_ARGS(); if (argc < 2 || argc > 4 || zend_get_parameters_ex(argc, &input, &offset, &length, &z_preserve_keys)) { - WRONG_PARAM_COUNT; + WRONG_PARA¬M_COUNT; } if (Z_TYPE_PP(input) != IS_ARRAY) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php