iliaa           Mon Nov 13 15:34:49 2006 UTC

  Modified files:              
    /php-src/ext/standard       array.c 
  Log:
  MFB: php_splice() optimization
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.390&r2=1.391&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.390 php-src/ext/standard/array.c:1.391
--- php-src/ext/standard/array.c:1.390  Sun Nov 12 01:11:58 2006
+++ php-src/ext/standard/array.c        Mon Nov 13 15:34:49 2006
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.390 2006/11/12 01:11:58 bjori Exp $ */
+/* $Id: array.c,v 1.391 2006/11/13 15:34:49 iliaa Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -1977,7 +1977,7 @@
                if (p->nKeyLength == 0) {
                        zend_hash_next_index_insert(out_hash, &entry, 
sizeof(zval *), NULL);
                } else {
-                       zend_u_hash_update(out_hash, p->key.type, 
ZSTR(p->key.arKey.s), p->nKeyLength, &entry, sizeof(zval *), NULL);
+                       zend_u_hash_quick_update(out_hash, p->key.type, 
ZSTR(p->key.arKey.s), p->nKeyLength, p->h, &entry, sizeof(zval *), NULL);
                }
        }
        
@@ -1989,7 +1989,7 @@
                        if (p->nKeyLength == 0) {
                                zend_hash_next_index_insert(*removed, &entry, 
sizeof(zval *), NULL);
                        } else {                        
-                               zend_u_hash_update(*removed, p->key.type, 
ZSTR(p->key.arKey.s), p->nKeyLength, &entry, sizeof(zval *), NULL);
+                               zend_u_hash_quick_update(*removed, p->key.type, 
ZSTR(p->key.arKey.s), p->nKeyLength, p->h, &entry, sizeof(zval *), NULL);
                        }
                }
        } else /* otherwise just skip those entries */
@@ -2000,17 +2000,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);
                }
        }
@@ -2022,7 +2012,7 @@
                if (p->nKeyLength == 0) {
                        zend_hash_next_index_insert(out_hash, &entry, 
sizeof(zval *), NULL);
                } else {
-                       zend_u_hash_update(out_hash, p->key.type, 
ZSTR(p->key.arKey.s), p->nKeyLength, &entry, sizeof(zval *), NULL);
+                       zend_u_hash_quick_update(out_hash, p->key.type, 
ZSTR(p->key.arKey.s), p->nKeyLength, p->h, &entry, sizeof(zval *), NULL);
                }
        }
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to