Skip to content
Tcl Source Code View Ticket
Login

View Ticket

remote alias invocation 10x slowdown

Closed / Fixed1626518fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2007-01-02 23:03:05
Not really a bug, but it seems that remote interp alias invocation has gotten a lot slower.  Like 10 times.

Here is the output from attached reproducable script.


TCL='8.3.4'
PROC      : 2 microseconds per iteration
LOCALALIAS: 3 microseconds per iteration
SUBINTERP : 4 microseconds per iteration

TCL='8.4.13'
PROC      : 1.455 microseconds per iteration
LOCALALIAS: 2.062 microseconds per iteration
SUBINTERP : 2.376 microseconds per iteration

TCL='8.5a3'
PROC      : 2.251 microseconds per iteration
LOCALALIAS: 3.678 microseconds per iteration
SUBINTERP : 19.705 microseconds per iteration

TCL='8.5a5'
PROC      : 2.128 microseconds per iteration
LOCALALIAS: 3.045 microseconds per iteration
SUBINTERP : 22.788 microseconds per iteration

This last is on Linux and configured with:

./configure --enable-symbols --disable-shared
pcmacdonplain2007-01-03 06:03:06
File Added - 209385: interp.tcl
pcmacdonplain2007-01-03 11:17:32
Logged In: YES 
user_id=190660
Originator: YES

I ran gprof profiling and tracked the slowdown to TclTransferResult(), in particular near the end, there was a change:

< (Interp *) targetInterp)->returnCode = ((Interp *) sourceInterp)->returnCode;
---
>    Tcl_SetReturnOptions(targetInterp,
            Tcl_GetReturnOptions(sourceInterp, result));

Setting this back restores performance???
pcmacdonplain2007-01-03 12:02:48
Logged In: YES 
user_id=190660
Originator: YES

Ah.  It looks like this involves the [return] enhancements.
I wonder if something like the following might be feasible,
as it restores performance:

    if (result == TCL_OK && iPtr->returnOpts==NULL) {
        ((Interp *) targetInterp)->returnCode = ((Interp *) sourceInterp)->returnCode;
    } else {
        Tcl_SetReturnOptions(targetInterp,
            Tcl_GetReturnOptions(sourceInterp, result));
        iPtr->flags &= ~(ERR_ALREADY_LOGGED);
    }
hobbsplain2007-01-03 15:04:53
Logged In: YES 
user_id=72656
Originator: NO

Don did the return additions, so I'll let him comment.
dgpplain2007-01-30 01:55:51
Logged In: YES 
user_id=80530
Originator: NO


That's the right idea, but the patch
I'm committing is a bit different in
the details.

Thanks for reporting the issue.
Log in (anonymous is fine) to add a comment.

Attachments: