diff options
author | das <das> | 2004-11-11 01:17:50 (GMT) |
---|---|---|
committer | das <das> | 2004-11-11 01:17:50 (GMT) |
commit | 99d46cc1bfb18bac0ed4cc9fab87fa9e320449f9 (patch) | |
tree | 3c8df3341409f16cf6e105d8a13a3998770dbc7c /generic/tclListObj.c | |
parent | a6c92c04cdb54a37f3ad2ae700d83396c811e023 (diff) | |
download | tcl-99d46cc1bfb18bac0ed4cc9fab87fa9e320449f9.zip tcl-99d46cc1bfb18bac0ed4cc9fab87fa9e320449f9.tar.gz tcl-99d46cc1bfb18bac0ed4cc9fab87fa9e320449f9.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]
Diffstat (limited to 'generic/tclListObj.c')
-rw-r--r-- | generic/tclListObj.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c index ef88192..162101c 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclListObj.c,v 1.19 2004/09/29 22:17:30 dkf Exp $ + * RCS: @(#) $Id: tclListObj.c,v 1.20 2004/11/11 01:17:51 das Exp $ */ #include "tclInt.h" @@ -791,17 +791,9 @@ Tcl_ListObjReplace(interp, listPtr, first, count, objc, objv) if ((numAfterLast > 0) && (shift != 0)) { Tcl_Obj **src, **dst; - if (shift < 0) { - for (src = elemPtrs + start, dst = src + shift; - numAfterLast > 0; numAfterLast--, src++, dst++) { - *dst = *src; - } - } else { - for (src = elemPtrs + numElems - 1, dst = src + shift; - numAfterLast > 0; numAfterLast--, src--, dst--) { - *dst = *src; - } - } + src = elemPtrs + start; dst = src + shift; + memmove((VOID*) dst, (VOID*) src, + (size_t) (numAfterLast * sizeof(Tcl_Obj*))); } /* |