Skip to content
Tcl Source Code History Of Ticket da2cb25ca2e6d5e6
Login

History Of Ticket da2cb25ca2e6d5e6

Artifacts Associated With Ticket da2cb25ca2e6d5e6

  1. Ticket change [f6ceaa5c4f] (rid 151091) by sebres on 2017-01-09 19:24:08:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/html"
    4. comment initialized to:
      <p>This is a interim PR, back-porting command <b>timerate</b> from my tclSE engine (<a href="https://github.com/sebres/tcl/pull/3">previous PR on github</a>).<br>
      <br>
      See branch <a href="timeline?n=100&r=sebres-trunk-timerate">sebres-trunk-timerate</a>.<br><br>
      Currently used as merge-point for clock-speed-up branch to compare performance between original tcl-clock and new tcl-clock engines.</p>
      <h4>Contains:</h4>
      <ul>
      <li>new command <code>timerate</code>, that allows to do the measurement of code executing more precise and in opposition to command <code>time</code> is time-related (not count-related);</li>
      <li>small fix to test tcl-clock under Windows (registry in development env);</li>
      </ul>
      <h4>Additionally pros of command "timerate"</h4>
      <ul>
      <li><code>timerate</code> can be calibrated to minimize influence of measurement overhead (and byte code execution overhead) - <code>timerate -calibrate {}</code>. <br>Following example diff shows influence of measurement and execution overheads (the times retrieved for execution of empty scope-block resp. of each <code>set i ...</code> is more precise after calibration), e. g. in reality the execution time of <code>set i ...</code> amounts to ca. 0.057 µs/#:</li>
      </ul>
      <div class="highlight highlight-source-diff"><pre><span class="pl-mi1"><span class="pl-mi1">+</span> % # calibrate to minimize influence of overhead:</span>
      <span class="pl-mi1"><span class="pl-mi1">+</span> % timerate -calibrate {}</span>
      <span class="pl-mi1"><span class="pl-mi1">+</span> 0.04763798110968011 µs/#-overhead, 0.048467 µs/#, 40275119 #, 20632745 #/sec</span>
        % timerate {}
      <span class="pl-md"><span class="pl-md">-</span> 0.049425 µs/#, 20232613 #, 20232613 #/sec</span>
      <span class="pl-mi1"><span class="pl-mi1">+</span> 0.003276 µs/#, 19640807 #, 305208960 #/sec</span>
        % timerate {set i 0} 5000
      <span class="pl-md"><span class="pl-md">-</span> 0.155394 µs/#, 32176202 #, 6435240 #/sec</span>
      <span class="pl-mi1"><span class="pl-mi1">+</span> 0.057090 µs/#, 47953979 #, 17516238 #/sec</span>
        % timerate {set i 0; set i 1} 5000
      <span class="pl-md"><span class="pl-md">-</span> 0.221634 µs/#, 22559694 #, 4511938 #/sec</span>
      <span class="pl-mi1"><span class="pl-mi1">+</span> 0.113668 µs/#, 31042572 #, 8797543 #/sec</span>
        % timerate {set i 0; set i 1; set i 2} 5000
      <span class="pl-md"><span class="pl-md">-</span> 0.293191 µs/#, 17053736 #, 3410747 #/sec</span>
      <span class="pl-mi1"><span class="pl-mi1">+</span> 0.190558 µs/#, 21012023 #, 5247746 #/sec</span></pre></div>
      <ul>
      <li>to reset previously calibrated overhead <code>timerate -calibrate {} 0</code> can be used;</li>
      <li>it can measure compiled and not compiled code pieces (use option <code>-direct</code> to disable "compilation" outside of measure cycle, and will be executed by <code>TclEvalObjEx</code> instead <code>TclNRExecuteByteCode</code>);<br>
      Normally it uses compiled version to measure (as it would be a part of compiled script or procedure body):</li>
      </ul>
      <div class="highlight highlight-source-diff"><pre><span class="pl-md"><span class="pl-md">-</span> # measure not-compiled version:</span>
      <span class="pl-md"><span class="pl-md">-</span> % timerate -direct {}</span>
      <span class="pl-md"><span class="pl-md">-</span> 0.089162 µs/#, 11215515 #, 11215515 #/sec</span>
      <span class="pl-mi1"><span class="pl-mi1">+</span> # measure compiled version:</span>
      <span class="pl-mi1"><span class="pl-mi1">+</span> % timerate {}</span>
      <span class="pl-mi1"><span class="pl-mi1">+</span> 0.049425 µs/#, 20232613 #, 20232613 #/sec</span></pre></div>
      <ul>
      <li>with option <code>-overhead</code> an external calculated overhead can be specified for the <code>timerate</code> command to measure execution of the part of script. Following example shows possibility to ignore overhead of execution of <code>_init</code> procedure resp. more precise the speed of part <code>string tolower ...</code> only:</li>
      </ul>
      <pre><code>% proc _init {} { string trim " test " }
      % timerate { set obj [_init]; string tolower $obj }
      0.758217 µs/#, 1318883 #, 1318883 #/sec
      % timerate \
         -overhead [lindex [timerate { set obj [_init] }] 0] \
                 { set obj [_init]; string tolower $obj }
      0.097757 µs/#, 1393420 #, 10229413 #/sec
      </code></pre>
      
    5. foundin initialized to: "tcl8.7 (portable to tcl8.6)"
    6. is_private initialized to: "0"
    7. login: "sebres"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "sebres"
    13. subsystem initialized to: "- New Builtin Commands"
    14. title initialized to:
      New command "timerate": measurement of execution time
      
    15. type initialized to: "RFE"
  2. Ticket change [7992485aa6] (rid 169724) by sebres on 2019-03-06 13:11:51:

    1. closedate changed to: "2458549.04990225"
    2. closer changed to: "sebres"
    3. icomment:
      Integrated as part of [/../tips/doc/trunk/tip/527.md|TIP#527].
      
    4. login: "sebres"
    5. mimetype: "text/x-fossil-wiki"
    6. resolution changed to: "Accepted"
    7. status changed to: "Closed"