All,
In my profiling of performance tests that run slowly in Tcl 8.6, I've found that TclCallVarTraces() is taking between 3% and 15% of total runtime for these tests.
Specifically, the runtime is in Tcl_Preserve()/Tcl_Release() of the two different pointers: Interp* and VarTrace*.
The truncated call stack for the hotspot is:
libtcl8.6.so ! Tcl_Preserve - tclPreserve.c
libtcl8.6.so ! TclCallVarTraces + 0x96 - tclTrace.c:2617
libtcl8.6.so ! TclPtrGetVarIdx + 0xb1 - tclVar.c:1410
libtcl8.6.so ! TEBCresume + 0xfcd - tclExecute.c:3324
libtcl8.6.so ! TclNRRunCallbacks + 0x46 - tclBasic.c:4435
Note: the calls to TclNRRunCallbacks begin to differ, most from Itcl, some from Tk, etc., but the above is the most common portion of the stack (with the line number in tclTrace.c changing, depending on whether the hotspot was for Interp* or VarTrace*)
My thought is to add reference counts to each of those structs and do the appropriate counting/freeing. This worked great in Itcl (see the commit:
https://core.tcl.tk/itcl/info/7388d76981118df3), and the same functional change worked just as well in an internal project here.
Questions:
1) Are there reasons that those particular structs shouldn't change? (akin to Tcl_Obj not changing until Tip 445 is complete)
2) If I were to make the change, what's the process for me submitting those changes? Do I just submit a patch (set of diffs), do I commit on a Fossil branch? Or, do I just request this kind of change and hope for the goodwill of the community?
thanks,
TJ
ps. Context: My other recent performance issue was reported here:
https://groups.google.com/forum/#!topic/comp.lang.tcl/Qd0Q11CxjgQ
pps. The Itcl performance issue (fixed already, yay!) was in the comments here:
https://sourceforge.net/p/incrtcl/bugs/271/