Artifacts Associated With Ticket 48a7a56dda
Ticket change [df64317355] (rid 237088) by apnadkarni on 2025-01-21 16:01:16:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-markdown"
- 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) ``` - foundin initialized to: "9.0.1"
- is_private initialized to: "0"
- login: "apnadkarni"
- priority initialized to: "5 Medium"
- private_contact initialized to: "9546e9877f1a8899e25a89082561ee694e7fb402"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "apnadkarni"
- subsystem initialized to: "- New Builtin Commands"
- title initialized to:
Documentation of timerate -overhead needs some detail
- type initialized to: "RFE"
Ticket change [62f5fe4717] (rid 237095) by sebres on 2025-01-21 16:39:15:
- 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.
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [d43c924501] (rid 237293) by apnadkarni on 2025-01-28 08:24:19:
- 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).
- login: "apnadkarni"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [21158ec466] (rid 237314) by sebres on 2025-01-28 10:47:29:
- closedate changed to: "2460703.94964454"
- closer changed to: "sebres"
- foundin changed to: "any"
- icomment:
Looks good, thx!<br/> Commit merged everywhere, closing ticket.
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- subsystem changed to: "06. Time Measurement"
- type changed to: "Bug"