|
2026-09-14
| ||
| 11:31 | • Ticket [fdfbd5e10f] Event, Notifier and Timer optimizations / implementation of ... artifact: 184f6e30d6 user: oehhar | |
| 11:03 | • Ticket [b7b707a310] win32 NRT-only - NativeGetTime backwards time-drifts bug (... artifact: 124cb22a90 user: sebres | |
| 00:12 | • Ticket [b7b707a310]: 3 changes artifact: 186f1d605b user: sebres | |
|
2025-11-03
| ||
| 13:52 | • Ticket [1238d4fdb0] MS-Win Time: QueryPerformanceFrequency does not return NULL ... artifact: 805086b908 user: sebres | |
|
2024-04-02
| ||
| 11:03 | • Ticket [de232b49f2] write-only nonblocking refchan and Tcl internal buffers ... artifact: b74d9f0dc2 user: sebres | |
|
2022-08-18
| ||
| 13:27 | • Ticket [1802895fff] AfterDelay overflow status still Open with 3 other chang... artifact: 3ba9e47b17 user: sebres | |
|
2021-09-03
| ||
| 12:31 | • Ticket [fdfbd5e10f] Event, Notifier and Timer optimizations / implementation of ... artifact: 46e01255c7 user: chw | |
| 12:06 | • Ticket [fdfbd5e10f]: 4 changes artifact: 6480a4a76a user: oehhar | |
|
2021-01-06
| ||
| 16:23 | • Ticket [570cb6afea] Not getting expected outut. status still Closed with 5 o... artifact: 9319dae2ac user: sebres | |
|
2019-08-23
| ||
| 12:27 | • Ticket [e484a8407c] pipe: time-related sporadic hangs in io/chan-io tests st... artifact: 2c197bbc56 user: sebres | |
|
2019-08-22
| ||
| 10:02 | • Ticket [e484a8407c]: 3 changes artifact: 618aa576db user: sebres | |
|
2019-04-09
| ||
| 10:31 | closes [1e5e25cf2b] - tests/cmdMZ.test: fixed NRT-related sleeps (and time-related corner cases and ... check-in: 84e29e7149 user: sebres tags: core-8-5-branch | |
|
2017-11-07
| ||
| 12:38 | • Ticket [fdfbd5e10f] Event, Notifier and Timer optimizations / implementation of ... artifact: 20b8216e77 user: sebres | |
|
2017-07-13
| ||
| 16:10 | • Ticket [fdfbd5e10f]: 3 changes artifact: 8d1d561547 user: sebres | |
|
2017-07-10
| ||
| 12:17 | • New ticket [fdfbd5e10f]. artifact: 90cb565845 user: sebres | |
Event, Notifier and Timer optimizations / implementation of TIPs #302, #434
Openfdfbd5e10fefdb605abf34f65535054c323d9394Created 9 years agoUpdated 79 days ago
Descriptionhtml2017-07-10 12:17:30
Implementation:
- [sebres-8-6-event-perf-branch] - 8.6 based branch- [sebres-8-5-event-perf-branch] - 8.5 based branch
First implemented (squashed rebased and cherry-picked) for 8.5-branch, because I made it basically for fork of this branch (it was just easy as direct for 8.6).
Contains:
- massive performance optimization of event-driven handling (test-cases included), so can be see as part of flightaware/Tcl-bounties#21;
- whole event-driven functionality is up to 1000-times faster now (especially by large event resp. timer lists, but also basic multi-threaded event-related things like async-IO, reflected channels, etc.);
- provided monotonic time (windows/unix);
- timer events and wait facilities are time-jump safe at all - implementation for TIP #302.
- full NRT- resp. RTS-capabilities (micro- resp. nanoseconds precise);
- implemented wide-clicks on unix (1 wide-click == 0.001 microseconds (1 nanosecond)), so more precise now (e. g. by time measurement etc.);
- windows high-resolution time rewritten without calibration thread now (faster, more robust and provides in addition monotonic time, not affected from the time-jumps);
- implements new sub-command
after atfor async trigger resp. sleep using absolute time (in seconds), that also time-jump safe, and in contrary toafter $offsuses absolute based time as due-time.
after at [clock scan "16:00:00"] {do_it_in_1600}
after at [clock scan "+1 minute"]; # wait to the next minute - thus fully implements flightaware/Tcl-bounties#2
- timer-events distinguish now between relative time-intervals (which use monotonic based time) and absolute due-time (which uses real-time base);
- ultimate solution (resp. fix) for ticket 0520d17284500573d7c46aa88e0c6b4ebc9b6a02
- handling round about objects returned by
after(and some internal interfaces) are more faster now, because hold the timer-event in the internal representation of object, so e. g.after info,after canceletc don't need to search an event in event-lists anymore (and therefore don't block the list with lock for the long time); - event (Tcl_Event) prolongation functionality (setting of
event->procto the callback causes reattach of this event to end of the queue, in contrary toreturn 0, which leaves the event on the current position, and thus can repeat it too early); - timer prolongation functionality (ATM only in C-API as
TclpProlongTimerEvent, can be later used as new sub-commandafter prolong); - Bonus:
- commands
vwaitandupdatecan control which events should be accepted:
update -timer
update -noidle
vwait -async -timer x - commands
vwaitcan use optional timeout:
if {![vwait -timer 10 tmrVar]} continue; # do something other resp. try later
if {![vwait 1000 evVar]} { error "timeout occurred" } - commands
vwaitcan work similar toupdate, without waiting for events (process only already occurring events):
if {[info exists evVar] || [vwait -nowait 10 evVar]} { puts "event already launched" }
## update and check we are done:
while {![vwait -nowait 0 done]} { do something other } - commands
afterandvwaitare microsecond precise now (so NRT-capable, also accept time as double):
after 0.01 [list accept $socket]; # do it in 10 microseconds
## wait 5 µs for "x" and if not yet ready, 25 µs for "y":
if {![vwait 0.005 x]} {vwait 0.025 y} - new clock sub-command
clock monotonicto provide monotonic time at tcl-level also; - etc. (I'll provide additional info later).
- commands
Summaries of the performance test-cases:
See sebres/tcl#4 (comment) for the performance comparision.sebreswiki2017-07-13 16:10:14
It looks like I had forgotten to back-port a small but important fix (sometimes causes busy wait in event-cycle).
Done now and merged in both branches.
sebreswiki2017-11-07 12:38:40
oehharwiki2021-09-03 12:06:51
Sebres remarked today, that this TIP also solves TIP302 for Unix and Windows.
That is really amazing stuff. Aparently, we at the TCL side have no Wizards who are even close to understand this.
Thank you again, I appreciate, Harald
chwplain2021-09-03 12:31:16
For the POSIX implementation, there's a lack of using CLOCK_MONOTONIC in the pthread_cond_*() functions, i.e. testing for availability and/or usability of pthread_condattr_setclock(). This is essential for really being immune against hiccups in CLOCK_REALTIME.
oehharplain2026-09-14 11:31:12
Sebres pinged again about this branches in [b7b707a310]. Due to the lack of Wizards on the TCL side we may only dream of this... Sorry, Harald
Log in (anonymous is fine) to add a comment.