|
From: Brian G. <bri...@me...> - 2013-01-17 21:37:17
|
Well, I have to apologize. :-}
The 8.4/8.5 difference is actually due to a change in my application where this (considerably simplified):
int tclprim_UserEval(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
{
return Tcl_GlobalEval(interp, argv[1]);
}
changed to this:
int tclprim_UserEval(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
{
return Tcl_GlobalEvalObj(interp, objv[1]);
}
At the Tcl script level, we have this constant (considerably simplified) code:
if {[catch {UserEval $cmd} msg]} {
mti_error_message "$msg\n"
} elseif {[string length $msg] > 0} {
mti_message "$msg\n"
}
When I analyzed the problem, the shimmer occurs at the [string length]. I had missed the C code change! Sorry!
However, that does not change that fact that [string length] conversion is aggressive. I'm not convinced it's a problem yet, but it is disconcerting. It seems like a local optimization or simplification that has a negative global impact.
-Brian
P.S. before you ask, the usereval interp is not necessarily the same interp the script is using, even though I wrote it that way above. Sometimes it is the same.
On Jan 17, 2013, at 11:09 AM, Porter, Don wrote:
>
> You're going to have to reveal whatever secrets you're not telling, because
> my copy of Tcl 8.4.14 shows:
>
> int
> Tcl_GetCharLength(objPtr)
> Tcl_Obj *objPtr; /* The String object to get the num chars of. */
> {
> String *stringPtr;
>
> SetStringFromAny(NULL, objPtr);
>
>
> Every [string length $x] will shimmer $x to the "string" Tcl_ObjType.
>
>
> ________________________________________
>> Looking at the 8.4 source code, it does the same. You should not see any
>> difference in the shimmer pattern moving from 8.4 to 8.5.
>>
>> Tcl_GetCharLength() calls SetStringFromAny() which shimmers. Don't you
>> see that in your examples?
>
> That's not my experience, comparing 8.4.14 vs 8.5.8.
> And practically speaking we deal with simple ascii 99.999% of the time, iso8859-1 technically. Also, most of the [string length] operations only care about !=0 tests.
>
> -Brian
|