From 06a24b87b9c810cdda2178d9b076750f15348a0b Mon Sep 17 00:00:00 2001 From: hobbs Date: Thu, 30 May 2002 03:26:40 +0000 Subject: * generic/tclExecute.c (TclExecuteByteCode INST_STR_CMP): * generic/tclCmdMZ.c (Tcl_StringObjCmd): changed the case for choosing the Tcl_UniCharNcmp compare to when both objs are of StringType, as benchmarks show that is the optimal check (both bigendian and littleendian systems). --- generic/tclCmdMZ.c | 16 +++++++--------- generic/tclExecute.c | 12 ++++++------ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 3707ca4..c5dfa5d 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.69 2002/05/29 10:35:45 dkf Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.70 2002/05/30 03:26:41 hobbs Exp $ */ #include "tclInt.h" @@ -1215,15 +1215,13 @@ Tcl_StringObjCmd(dummy, interp, objc, objv) string1 = (char*) Tcl_GetByteArrayFromObj(objv[0], &length1); string2 = (char*) Tcl_GetByteArrayFromObj(objv[1], &length2); strCmpFn = memcmp; - } else if (((objv[0]->typePtr == &tclStringType) - && (objv[0]->bytes == NULL)) - || ((objv[1]->typePtr == &tclStringType) - && (objv[1]->bytes == NULL))) { + } else if ((objv[0]->typePtr == &tclStringType) + && (objv[1]->typePtr == &tclStringType)) { /* - * Use UNICODE versions of string comparisons since that - * won't cause undue type conversions and we can work with - * characters all of a fixed size (much faster.), but only - * when one of the objects is a pure UNICODE object. + * Do a unicode-specific comparison if both of the args + * are of String type. In benchmark testing this proved + * the most efficient check between the unicode and + * string comparison operations. */ string1 = (char*) Tcl_GetUnicodeFromObj(objv[0], &length1); string2 = (char*) Tcl_GetUnicodeFromObj(objv[1], &length2); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 4658711..9d3ec1c 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.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: tclExecute.c,v 1.55 2002/05/29 10:35:45 dkf Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.56 2002/05/30 03:26:40 hobbs Exp $ */ #include "tclInt.h" @@ -2741,12 +2741,12 @@ TclExecuteByteCode(interp, codePtr) iResult = memcmp(s1, s2, (size_t) ((s1len < s2len) ? s1len : s2len)); } else if (((valuePtr->typePtr == &tclStringType) - && (valuePtr->bytes == NULL)) - || ((value2Ptr->typePtr == &tclStringType) - && (value2Ptr->bytes == NULL))) { + && (value2Ptr->typePtr == &tclStringType))) { /* - * Do a unicode-specific comparison if one of the args - * only has the unicode rep. + * Do a unicode-specific comparison if both of the args + * are of String type. In benchmark testing this proved + * the most efficient check between the unicode and + * string comparison operations. */ Tcl_UniChar *uni1, *uni2; uni1 = Tcl_GetUnicodeFromObj(valuePtr, &s1len); -- cgit v0.12