summaryrefslogtreecommitdiffstats
path: root/generic/tclHash.c
diff options
context:
space:
mode:
authordas <das@noemail.net>2004-11-11 01:17:50 (GMT)
committerdas <das@noemail.net>2004-11-11 01:17:50 (GMT)
commitaa5b76f15d68473f22d8c42b06993bc8a1ffd663 (patch)
tree3c8df3341409f16cf6e105d8a13a3998770dbc7c /generic/tclHash.c
parentf2024e4ce20a171caf00bfd3d24086953e2fa856 (diff)
downloadtcl-aa5b76f15d68473f22d8c42b06993bc8a1ffd663.zip
tcl-aa5b76f15d68473f22d8c42b06993bc8a1ffd663.tar.gz
tcl-aa5b76f15d68473f22d8c42b06993bc8a1ffd663.tar.bz2
* generic/tclListObj.c (Tcl_ListObjReplace): use memmove() instead
of manual copy loop to shift list elements. Decreases time spent in Tcl_ListObjReplace() from 5.2% to 1.7% of overall runtime of tclbench on a ppc 7455 (i.e. 200% speed increase). [Patch 1064243] * generic/tclHash.c: hoisted some constant pointer dereferences out of loops to eliminate redundant loads that the gcc optimizer didn't deal with. Decreases time spend in Tcl_FindHashEntry() by 10% over a full run of the tcl testuite on a ppc 7455. [Patch 1064243] FossilOrigin-Name: 30ac98366b1320896fc3fa95e5baf5bfa097a366
Diffstat (limited to 'generic/tclHash.c')
-rw-r--r--generic/tclHash.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/generic/tclHash.c b/generic/tclHash.c
index af2805a..14de98a 100644
--- a/generic/tclHash.c
+++ b/generic/tclHash.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclHash.c,v 1.21 2004/10/06 13:43:53 dkf Exp $
+ * RCS: @(#) $Id: tclHash.c,v 1.22 2004/11/11 01:17:50 das Exp $
*/
#include "tclInt.h"
@@ -310,6 +310,7 @@ Tcl_FindHashEntry(tablePtr, key)
*/
if (typePtr->compareKeysProc) {
+ Tcl_CompareHashKeysProc *compareKeysProc = typePtr->compareKeysProc;
for (hPtr = tablePtr->buckets[index]; hPtr != NULL;
hPtr = hPtr->nextPtr) {
#if TCL_HASH_KEY_STORE_HASH
@@ -317,7 +318,7 @@ Tcl_FindHashEntry(tablePtr, key)
continue;
}
#endif
- if (typePtr->compareKeysProc ((VOID *) key, hPtr)) {
+ if (compareKeysProc ((VOID *) key, hPtr)) {
return hPtr;
}
}
@@ -408,6 +409,7 @@ Tcl_CreateHashEntry(tablePtr, key, newPtr)
*/
if (typePtr->compareKeysProc) {
+ Tcl_CompareHashKeysProc *compareKeysProc = typePtr->compareKeysProc;
for (hPtr = tablePtr->buckets[index]; hPtr != NULL;
hPtr = hPtr->nextPtr) {
#if TCL_HASH_KEY_STORE_HASH
@@ -415,7 +417,7 @@ Tcl_CreateHashEntry(tablePtr, key, newPtr)
continue;
}
#endif
- if (typePtr->compareKeysProc ((VOID *) key, hPtr)) {
+ if (compareKeysProc ((VOID *) key, hPtr)) {
*newPtr = 0;
return hPtr;
}
@@ -701,13 +703,14 @@ Tcl_NextHashEntry(searchPtr)
* Tcl_FirstHashEntry. */
{
Tcl_HashEntry *hPtr;
+ Tcl_HashTable *tablePtr = searchPtr->tablePtr;
while (searchPtr->nextEntryPtr == NULL) {
- if (searchPtr->nextIndex >= searchPtr->tablePtr->numBuckets) {
+ if (searchPtr->nextIndex >= tablePtr->numBuckets) {
return NULL;
}
searchPtr->nextEntryPtr =
- searchPtr->tablePtr->buckets[searchPtr->nextIndex];
+ tablePtr->buckets[searchPtr->nextIndex];
searchPtr->nextIndex++;
}
hPtr = searchPtr->nextEntryPtr;