TIP #378: Fixing the Performance of TIP 280

Title:Fixing the Performance of TIP 280
Version:$Revision: 1.3 $
Authors: Andreas Kupries <andreask at activestate dot com>
Jeff Hobbs <jeffh at activestate dot com>
Created:Monday, 04 October 2010


A Tcl command is proposed which enable a user of Tcl to disable the most performance intensive parts of the TIP #280 implementation, at the loss of some detail.

Background and Motivation

TIP #280 extended Tcl's abilities for introspection with the info frame command able to determine the location of its call, i.e., the name of the file the code is in, and the absolute line number in that file.

In the quest for the best possible detail one particular part of the implementation had a great impact on the performance of bytecode execution, doing complex stack/hash manipulations for each argument of each INST_INVOKE_STK instruction to keep track of the location of scripts delivered to uplevel commands as arguments of Tcl procedures (i.e., implementations of control structures in Tcl).

This TIP now proposes to put the execution of this part of TIP #280's implementation under user control, allowing them to trade info frame-exactness for speed, and vice versa.

Script Level API

interp debug interp-path ?-frame ?boolean??

This API was chosen to be potentially extensible for other future interpreter level control needs.

Default Setting

This behavior will be turned off by default, unless Tcl is compiled with -DTCL_INTERP_DEBUG_FRAME or $::env(TCL_INTERP_DEBUG_FRAME) is set at interpreter creation time.

Note that this is a one-way switch because the info frame tracking is maintained in a stack that must remain consistent once switched on. Switching off when deep in the stack would cause memory loss and possible crashes without tracing on top of tracing, and it is felt that being an interp-level switch, one-way switching should be sufficient for user needs.

Reference Implementation

A reference implementation is provided at SourceForge [1].


This document has been placed in the public domain.

Powered by Tcl[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]

TIP AutoGenerator - written by Donal K. Fellows