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
|
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
|
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
|
A compile-time macro and an environment variable are introduced which enable a
user of Tcl to trade some functionality brought by [[280]](280.md) for better
performance.
# Background and Motivation
[[280]](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.
[[280]](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).
Though that functionality was very useful while debugging Tcl scripts it hardly
had any other use, while at the same time negatively impacting the performance
of Tcl code. [[378]](378.md) has already addressed the most critical degradation
of performance caused by [[280]](280.md), however a milder slowdown has remained.
The mere fact that line continuations are tracked unconditionally and such
information, if present, is associated with a respective Tcl object through
an external hash map results in a relatively expensive check performed in
TclFreeObj() for every single object. 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]](280.md)'s
implementation under user control, allowing them to trade **info
frame**-exactness for speed, and vice versa.
This TIP now proposes to put the execution of the respective part of
[[280]](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:
|