Skip to content
Tcl Source Code History Of Ticket 48a7a56dda
Login

History Of Ticket 48a7a56dda

Artifacts Associated With Ticket 48a7a56dda

  1. Ticket change [df64317355] (rid 237088) by apnadkarni on 2025-01-21 16:01:16:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-markdown"
    4. comment initialized to:
      Reminder to self to add to docs based on following explanation from Sergey.
      
      ```
      [21:02]	apn 	Let me typ ean example
      [21:03]	apn 	% timerate -calibrate {}
      		0.03468333977558236 µs/#-overhead 0.034767 µs/# 56144881 # 28762746 #/sec
      		% timerate {incr x}
      		0.086050 µs/# 8282712 # 11621140 #/sec 712.728 net-ms
      		% timerate {}
      		0.003148 µs/# 26433088 # 317655750 #/sec 83.213 net-ms
      		% timerate -overhead 0.003148 {incr x}
      		0.108830 µs/# 8930339 # 9188650 #/sec 971.888 net-ms
      [21:04]	apn 	I would have expected the measurement of incr x in the two cases to be much closer
      [21:05]	apn 	(Similar proportionate differences for more expensive operations)
      ++++++++++++++++++++++ End Of History ++++++++++++++++++++++
      
      [21:08]	sebres ›	apn, you used calibrated call to estimate overhead... this is not quite correct, let me explain with an example:
      [21:08]	sebres ›	  % proc test {} { set ovh [lindex [timerate {incr i}] 0]; timerate -overhead $ovh { incr i } }; test
      [21:08]	sebres ›	  0.000000 µs/# 10536827 # 10536827000000 #/sec 0.001 net-ms
      [21:08]	sebres ›	  % timerate -calibrate {}
      [21:08]	sebres ›	  0.03138602152473443 µs/#-overhead 0.031464 µs/# 62038772 # 31782157 #/sec
      [21:08]	sebres ›	  % proc test {} { set ovh [lindex [timerate {incr i}] 0]; timerate -overhead $ovh { incr i } }; test
      [21:08]	sebres ›	  0.030830 µs/# 10408764 # 32435958 #/sec 320.902 net-ms
      [21:08]	sebres ›	  % proc test {} { set ovh [lindex [timerate -overhead 0 {incr i}] 0]; timerate -overhead $ovh { incr i } }; test
      [21:08]	sebres ›	  0.000000 µs/# 10427036 # 10427036000000 #/sec 0.001 net-ms
      [21:09]		bwani54 macht wie eine Banane...
      [21:09]	sebres ›	... if you used calibrate - use -overhead 0 for timerate call estimating the overhead
      [21:10]		henriquegogo wandelt luid schreeuwend binnen.
      [21:12]	sebres ›	however I'm not against to fix it - e. g. to sum the overhead with a calibration value stored internally, so this `-overhead 0` becomes redundant
      [21:13]	apn 	Back, let me go through that ...
      [21:18]	apn 	So currently, the -calibrate invocation only affects the next measurement?
      [21:19]	sebres ›	no, it affects the calls without overhead (it uses internal overhead)
      [21:19]	apn 	Gotcha
      [21:19]	sebres ›	well, the "fix" would not become superfluous, it'd be a bit incompatible if used previously, so if we'd fix it, one need to mention it somewhere in the docu
      [21:19]	apn 	So it's kind of the overhead used if -overhead is not specified.
      [21:21]	sebres ›	exactly, if no -overhead, use calibrated overhead, otherwise values given with -overhead
      [21:21]	apn 	I think the current behavior is ok but I did not understand that from the manpage. I'll go read it again to see if I missed something.
      [21:21]	sebres ›	... the fix may be a sum of both
      [21:21]	apn 	And to measure the overhead, one should also pass -overhead 0 to the command
      [21:21]	apn 	right?
      [21:22]	sebres ›	currently yes (to be sure, the -calibrate overhead is not evolved)
      ```
      
    5. foundin initialized to: "9.0.1"
    6. is_private initialized to: "0"
    7. login: "apnadkarni"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "9546e9877f1a8899e25a89082561ee694e7fb402"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "apnadkarni"
    14. subsystem initialized to: "- New Builtin Commands"
    15. title initialized to:
      Documentation of timerate -overhead needs some detail
      
    16. type initialized to: "RFE"
  2. Ticket change [62f5fe4717] (rid 237095) by sebres on 2025-01-21 16:39:15:

    1. icomment:
      Alternatively, [98b8512f2f85cb49] may fix this on the code side (not the documentation side) in the form that <code>-overhead 0</code> becomes superfluous or rather will be unexpected anymore to estimate the overhead (in calibrated timerate). The whole overhead considered by timerate call is then a sum of both, the given with <code>-overhead</code> value and the internal value estimated by calibration. With other words, the <code>-overhead 0</code> must no longer be used in that case to measure the overhead with previously calibrated timerate.
      
      Pros:
      
        * don't need to know whether it was calibrated or not, <code>-overhead 0</code> becomes redundant;
        * calibration of empty evaluation (cost of invocation) wouldn't reflect in estimated overhead, it becomes hidden now.
      
      Cons:
      
        * a bit backwards incompatible; 
        * possibly unwanted behaviour under some circumstances - it'd indirectly depend on the calibration, which did before overhead measurement, if it changes later, the overhead may be wrong (but such "circumstances" are rather artificial thing, imho;
        * the estimated overhead doesn't reflect the calibration overhead anymore - it is hidden now for any case.
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  3. Ticket change [d43c924501] (rid 237293) by apnadkarni on 2025-01-28 08:24:19:

    1. icomment:
      @sebres, having thought about it, I think updating the example in the manpage is preferable to changing the behavior of `timerate` in an incompatible fashion, no matter how minor.
      
      If you agree, please review the suggested [manpage change](https://core.tcl-lang.org/tcl/info/7b733ffdb2dbee8a).
      
    2. login: "apnadkarni"
    3. mimetype: "text/x-markdown"
  4. Ticket change [21158ec466] (rid 237314) by sebres on 2025-01-28 10:47:29:

    1. closedate changed to: "2460703.94964454"
    2. closer changed to: "sebres"
    3. foundin changed to: "any"
    4. icomment:
      Looks good, thx!<br/>
      Commit merged everywhere, closing ticket.
      
    5. login: "sebres"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"
    9. subsystem changed to: "06. Time Measurement"
    10. type changed to: "Bug"