cvs: ZendEngine2 / zend_hash.c

From: Date: Thu, 29 Jul 2004 19:18:46 +0000
Subject: cvs: ZendEngine2 / zend_hash.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2824@lists.php.net to get a copy of this message
helly Thu Jul 29 15:18:46 2004 EDT Modified files: /ZendEngine2 zend_hash.c Log: - Increase performance of *sort() and some internal sort operations. # This patch increases the performance of small arrays/hashes by up to ~15% # The performance increase during the performance talk :-) http://cvs.php.net/diff.php/ZendEngine2/zend_hash.c?r1=1.115&r2=1.116&ty=u Index: ZendEngine2/zend_hash.c diff -u ZendEngine2/zend_hash.c:1.115 ZendEngine2/zend_hash.c:1.116 --- ZendEngine2/zend_hash.c:1.115 Sat Jul 10 03:45:49 2004 +++ ZendEngine2/zend_hash.c Thu Jul 29 15:18:46 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_hash.c,v 1.115 2004/07/10 07:45:49 andi Exp $ */ +/* $Id: zend_hash.c,v 1.116 2004/07/29 19:18:46 helly Exp $ */ #include "zend.h" @@ -1138,14 +1138,20 @@ ht->pListTail = NULL; ht->pInternalPointer = ht->pListHead; - for (j = 0; j < i; j++) { - if (ht->pListTail) { - ht->pListTail->pListNext = arTmp[j]; - } - arTmp[j]->pListLast = ht->pListTail; - arTmp[j]->pListNext = NULL; - ht->pListTail = arTmp[j]; - } + arTmp[0]->pListLast = NULL; + if (i > 1) { + arTmp[0]->pListNext = arTmp[1]; + for (j = 1; j < i-1; j++) { + arTmp[j]->pListLast = arTmp[j-1]; + arTmp[j]->pListNext = arTmp[j+1]; + } + arTmp[j]->pListLast = ht->pListTail; + arTmp[j]->pListNext = NULL; + } else { + arTmp[0]->pListNext = NULL; + } + ht->pListTail = arTmp[i-1]; + pefree(arTmp, ht->persistent); HANDLE_UNBLOCK_INTERRUPTIONS();

« previous php.zend-engine.cvs (#2824) next »