andrey          Sat Feb 22 05:54:27 2003 EDT

  Modified files:              
    /php4/ext/standard  array.c 
  Log:
  rehash only in case something is changed.
  #lowers the execution time in half on my machine on array with 1000 elements
  #with nonscalar keys. Maybe it can be optimized further.
  
  
Index: php4/ext/standard/array.c
diff -u php4/ext/standard/array.c:1.220 php4/ext/standard/array.c:1.221
--- php4/ext/standard/array.c:1.220     Thu Feb  6 10:27:53 2003
+++ php4/ext/standard/array.c   Sat Feb 22 05:54:26 2003
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.220 2003/02/06 15:27:53 sniper Exp $ */
+/* $Id: array.c,v 1.221 2003/02/22 10:54:26 andrey Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -1866,7 +1866,9 @@
                        p = p->pListNext;
                }
                Z_ARRVAL_PP(stack)->nNextFreeElement = k;
-               zend_hash_rehash(Z_ARRVAL_PP(stack));
+               if (k) {
+                       zend_hash_rehash(Z_ARRVAL_PP(stack));
+               }
        } else if (!key_len) {
                Z_ARRVAL_PP(stack)->nNextFreeElement = 
Z_ARRVAL_PP(stack)->nNextFreeElement - 1;
        }



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

Reply via email to