Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.
|Comment:||New TIP 530|
|Downloads:||Tarball | ZIP archive | SQL archive|
|Timelines:||family | ancestors | descendants | both | trunk|
|Files:||files | file ages | folders|
|User & Date:||leon 2018-12-13 13:37:27|
|19:08||Edited tip/530.md check-in: cecc0dd69e user: leon tags: trunk|
|13:37||New TIP 530 check-in: 99daffc5b5 user: leon tags: trunk|
|11:00||Editorial pass on 507 check-in: 75f5c2c704 user: dkf tags: trunk|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
# TIP 530: Control over performance impact of TIP 280 Author: Leon Manukyan <email@example.com> State: Draft Type: Project Vote: Pending Created: 13-Dec-2018 Tcl-Version: 8.6, 8.7 Post-History: Tcl-Ticket: a09031e288 ----- # Abstract A compile-time macro and an environment variable are introduced which enable a user of Tcl to trade some functionality brought by [](280.md) for better performance. # Background and Motivation [](280.md) 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. Though that functionality is very useful while debugging Tcl scripts it hardly has any other use, while at the same, due to the peculiarity of its implementation, negatively impacting the performance of Tcl code. The issue has first been discussed at [comp.lang.tcl](https://groups.google.com/forum/#!topic/comp.lang.tcl/Qd0Q11CxjgQ). This TIP now proposes to put the execution of some part of [](280.md)'s implementation under user control, allowing them to trade **info frame**-exactness for speed, and vice versa. # Run-time control The environment variable `TCL_INFO_FRAME_ENABLE_ACCURATE_LINE_NUMBERS` is checked during the startup of the main Tcl interpreter and handling of line continuations is fixed till the end of execution as follows: * If the value of that environment variable is 0, then line continuations (backslash+newline) sequences are not tracked (thus resulting in improved performance) and the line numbers returned by `info frame` may be wrong. * For any other value of that environment variable the line continuations are tracked and correct line numbers are reported by `info frame`. # Build-time control The default value assumed for the environment variable `TCL_INFO_FRAME_ENABLE_ACCURATE_LINE_NUMBERS` when it is unset is defined by the compilation macro of the same name. That is a Tcl interpreter built with `-DTCL_INFO_FRAME_ENABLE_ACCURATE_LINE_NUMBERS=X` will behave by default as if the env var `TCL_INFO_FRAME_ENABLE_ACCURATE_LINE_NUMBERS` is set to `X` (but the actual value of that variable, if it is set, will be respected). ## Default Setting Unless users don't take any deliberate action (assuming that they didn't use the said compilation macro in their build processes or the environment variable in their flows) they won't notice any change in behavior. # Reference Implementation A reference implementation is provided at <https://core.tcl.tk/tcl/artifact/3b68b7cd8131a42a> . # Copyright This document has been placed in the public domain.