Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 184b38e588622e30e90391f212985482c4480a2690094cfe109663acbe6643e3
Ticket: e02798626dfbcd7b33db19e0fc3a9fb9fa0714f4
clock command is 8 times slower with Tcl 9.0b1
User & Date: sebres on 2024-02-26 22:28:04
Changes

  1. icomment:
    Back to the issue...
    Ultimately, I found what the problem is: it is not clock at all (or not directly clock).<br/>Moreover, the fix using merge of clock-speedup will help only conditionally.<br/>But I'll try to explain it bit by bit...
    
    My profiler module doesn't work for 9.0 (it segfaults), so I wrote a small simple tcl-level profiler tool and injection for <code>::tcl::clock::add</code> (since it has been showing the same issue) - [https://gist.github.com/sebres/4da0d7679211122bb2fe4f0d2e80c908/1849bc383883aa78adf0705311296700a653951e|GIST/sebres/4da0d76792111(v1)]
    
    How one can see it drastically increased times in <code>entloc</code> and <code>chngov</code> blocks.<br/>
    Both of this blocks definitely uses <code>msgcat</code>, and if we'll measure <code>chngov</code> solely:
    
        % timerate { namespace inscope ::tcl::clock { mc GREGORIAN_CHANGE_DATE } }
        -3.939602 µs/# 253833 # 253832 #/sec 1000.001 net-ms
        +2.451155 µs/# 407971 # 407971 #/sec 1000.000 net-ms
    
    it'd show marginal deviation (it's surely slower than 8.6, but doesn't cost 30µs/# and basically 10 times faster than if it is executed within <code>::tcl::clock::add</code>).
    
    Because it also affect <code>entloc</code> block, which also uses <code>msgcat</code>, I guess the catalogue simply shimmers somewhere internally.
    
    To confirm that, I modified the gist like here - [https://gist.github.com/sebres/4da0d7679211122bb2fe4f0d2e80c908/revisions?diff=split&w=|GIST/sebres/4da0d76792111(v1)].
    
    And the result is as expected many times faster, and now the profiler blocks are sorted similar to 8.6 (<code>init</code> and <code>calc</code> are before both blocks <code>entloc</code> and <code>chngov</code> using <code>mc</code>).
    
    <b>My conclusion: this is rather an issue of <code>msgcat</code> (or probably the impossibility to use certain API of it from C-code without to shimmer).</b>
    My guess - some catalog continuously shimmers between dict and something else (I have no time to take a closer look right now, but suspect this could be a [/../tips/doc/trunk/tip/490.md|TIP#490] or [/../tips/doc/trunk/tip/499.md|TIP#499] (or some <code>mc</code>-enhancement hereafter).
    
    Thus, as already assumed, this worsening must be fixed regardless the clock-speedup merge (or at least documented like "don't use ... anymore"), because otherwise people using <code>msgcat</code> (in "improper" way) could experience similar regressions in 8.7 or 9.0.
    
  2. login: "sebres"
  3. mimetype: "text/x-fossil-wiki"