Tcl Source Code

View Ticket
Login
Ticket UUID: 1626518
Title: remote alias invocation 10x slowdown
Type: Bug Version: obsolete: 8.5a5
Submitter: pcmacdon Created on: 2007-01-02 23:03:05
Subsystem: 20. [interp] Assigned To: dgp
Priority: 6 Severity:
Status: Closed Last Modified: 2007-01-30 01:55:51
Resolution: Fixed Closed By: dgp
    Closed on: 2007-01-29 18:55:51
Description:
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
User Comments: dgp added on 2007-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.

hobbs added on 2007-01-03 15:04:53:
Logged In: YES 
user_id=72656
Originator: NO

Don did the return additions, so I'll let him comment.

pcmacdon added on 2007-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);
    }

pcmacdon added on 2007-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???

pcmacdon added on 2007-01-03 06:03:06:

File Added - 209385: interp.tcl

Attachments: