summaryrefslogtreecommitdiffstats
path: root/generic
Commit message (Collapse)AuthorAgeFilesLines
* avoid busy wait if new short block-time will be set within service ↵sebres_event_perf_fix_busy_waitsebres2017-07-131-7/+22
| | | | event-cycle (Tcl_DoOneEvent) produced in event-cycle without processing
* timer: fixed setup of the block-time to 0.0 by pending timer of new ↵sebres2017-07-131-1/+0
| | | | | generation, example: tclsh -c "proc test {} {after 1000 test}; test; vwait infinite"
* merge core-8-5-branchsebres2017-07-104-979/+972
|\
| * tclPathObj: fixed TclJoinPath (backported from 8.6) - usage of released ↵sebres2017-07-031-84/+70
| | | | | | | | | | object and object leakage. closes [adb198c256df8c4192838cc3c1112fb2821314e9]
| * Upgrade all internal character tables to Unicode 10jan.nijtmans2017-06-222-807/+836
| |
| * Fix [2738427]: Tcl_NumUtfChars(...) no overflow check.jan.nijtmans2017-06-081-13/+14
| |
| * [67aa9a2070] Tcl_UtfToUniChar returns single byte for invalid UTF-8 input as ↵jan.nijtmans2017-06-061-75/+52
| | | | | | | | documented.
* | avoid blocking wait if we've some retarded events (from last event-cycle) ↵sebres2017-07-101-0/+12
| | | | | | | | and max blocking time was not set outside an event source traversal.
* | reintegrate sebres-8-6-event-perf-branch back to 8.5sebres2017-07-105-198/+406
|\ \
| * | Stability fix: queue epoch to guarantee avoid broken queue, service level to ↵sebres2017-07-104-175/+374
| | | | | | | | | | | | | | | | | | | | | | | | | | | avoid reset block time by nested event-cycles (if Tcl_SetTimer does not create it), etc. Fixed retarded events (using new retarded list, the involve of the retarded events occurs only after checking of all event sources now). Two opportunities to retard event: - lazy, using the same event-object: in the handler set event->proc to new (or the same) handler (fast, possible only if not entering new event-cycle in handler); - create the event with new position "TCL_QUEUE_RETARDED"; New inline functions TclpQueueEventClientData / TclpQueueEventEx to fast creating resp. queuing event with extra data.
| * | merge resp. reintegrate sebres-8-5-event-perf-branch to 8.6sebres2017-07-1010-619/+2243
| |\ \ | |/ / |/| |
* | | after at: added simple workaround for absolute timers/sleep ("after at ↵sebres2017-07-031-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | real-time"): because we use monotonic time in all wait functions, so to avoid too long wait by the absolute timers (to be able to trigger it) if time jumped to the expected absolute time, just let block for maximal 1 second if absolute timers available. test-cases: time-jumps (TIP #302) test covered now. Note: on some platforms it is only possible if the user has corresponding privileges to change system date and time. Ex.: sudo LD_LIBRARY_PATH=. ./tclsh ../tests/timer.test -match timer-20.*
* | | code review and small optimizations sebres2017-07-031-8/+10
| | |
* | | fix check event source threshold (corresponds 100-ns ranges, if the ↵sebres2017-07-031-38/+51
| | | | | | | | | | | | | | | | | | wide-clicks supported); because of variable width of 1 wide-click: windows - frequency dependent, unix - nanoseconds, darwin/osx - tb.numer / tb.denom nanoseconds.
* | | Introduced monotonic time as ultimate fix for time-jump issue (fixed for ↵sebres2017-07-035-138/+150
| | | | | | | | | | | | | | | | | | | | | windows and unix now, TIP #302 fully implemented now); Usage of monotonic time instead of adjustment via timeJump/timeJumpEpoch is more precise and effective. New sub-command "clock monotonic" to provide monotonic time facility for tcl-level.
* | | don't cancel scheduled event as long as the event list is not bidirectional ↵sebres2017-07-031-1/+9
| | | | | | | | | | | | (too slow by large queue) - rewritten to cancel delayed (by execute it).
* | | fixed timer-marker handling: timer should be always executed after queued ↵sebres2017-07-035-194/+215
| | | | | | | | | | | | | | | | | | event (of the same generation), it was marked (be sure it marked to immediate execution in corresponding checkProc only). tclIO: scheduled event rewritten using Tcl_Event instead of timer event (IO is not timer, e. g. executed also by usage of `vwait -notimer ...`, etc).
* | | interim commit: trying to pass test-cases - timer-3.*, chan-io-29.34, ↵sebres2017-07-033-60/+118
| | | | | | | | | | | | socket-2.12 (busy prompt timer, unexpected too early timer event, wrong timer-marker usage)
* | | Merge branch 'fix-busy-prompt-timers' into event-perf-branch: sebres2017-07-031-34/+81
| | | | | | | | | | | | | | | | | | | | | * Amend to timer-marker: dualize special state of timer-marker (to differentiate between timer generations), so: INT2PTR(-1) - exec immediate (marker reached); INT2PTR(-2) - check in the next-cycle (marker reached only if no other events available); Avoids permanent busy execution of prompt-events (always busy in timer), if they regenerate itself continuously for waiting for other events (like writable/readable), see e. g. socket-2.12.
* | | "after at" set factor to 1000000 (seconds), test cases fixed sebres2017-07-031-5/+5
| | |
* | | code review, rewrite tclTimer, prolongation, etc. sebres2017-07-036-404/+562
| | |
* | | interim commit: code review, rewrite tclTimer, etc. sebres2017-07-035-111/+219
| | |
* | | revert dual lists (relative/absolute) back to single list (because of better ↵sebres2017-07-031-109/+63
| | | | | | | | | | | | handling, a bit faster, etc.)
* | | amend with review sebres2017-07-031-16/+53
| | |
* | | don't use tolerance in vwait, because of dual usage, it causes canceling of ↵sebres2017-07-031-8/+2
| | | | | | | | | | | | wait before end-time, on small timeout values (like 0.5, etc.)
* | | interim commit: trying to resolve time-freezes with new facilities ↵sebres2017-07-034-148/+180
| | | | | | | | | | | | timeJump/timeJumpEpoch
* | | interim commit: trying to resolve time-freezes with new facilities ↵sebres2017-07-034-178/+409
| | | | | | | | | | | | timeJump/timeJumpEpoch
* | | interim commit: try to fix time-drift backwards (calibration? something ↵sebres2017-07-032-1/+4
| | | | | | | | | | | | else?)...
* | | interim commit: try to fix time-drift backwards (too long offset after ↵sebres2017-07-032-4/+23
| | | | | | | | | | | | calibration? something else?)...
* | | bug fix: prevent setting of negative block-time by too few initial ↵sebres2017-07-031-6/+8
| | | | | | | | | | | | wait-time, that may expire immediately (for example `vwait 0.0001 test`).
* | | after info, after cancel: compare interpreter of the timer-events by direct ↵sebres2017-07-031-2/+2
| | | | | | | | | | | | retrieving via internal representation (ignore foreign events), test cases extended.
* | | resolved some warnings / fixed unix resp. x64 compilation sebres2017-07-033-6/+5
| | |
* | | code review + better usage of the waiting tolerance (fewer CPU-greedy now, ↵sebres2017-07-033-16/+64
| | | | | | | | | | | | | | | | | | | | | avoid busy-wait if the rest of wait-time too small and can be neglected); TMR_RES_TOLERANCE can be defined to use wait-tolerance on *nix platforms (currently windows only as relation resp. deviation between default timer resolution 15.600 in exact milliseconds, means 15600/15000 + small overhead); Decreasing of TMR_RES_TOLERANCE (up to 0) makes tcl more "RTS" resp. NRT-capable (very precise wait-intervals, but more CPU-hungry).
* | | [win] fallback to replace C++ keyword "inline" with C keyword "__inline" sebres2017-07-031-0/+10
| | | | | | | | | | | | | | | Otherwise depending on the VC-version, context, include-order it can cause: error C2054: expected '(' to follow 'inline'
* | | [win32] use timer resolution handling in Tcl_Sleep also; sebres2017-07-031-10/+12
| | |
* | | optimization of Tcl_LimitExceeded by internal usage (tclInt header) sebres2017-07-032-0/+10
| | |
* | | dynamic increase of timer resolution corresponding wait-time; sebres2017-07-034-56/+77
| | | | | | | | | | | | non-blocking wait for event - if block-time set outside an event source traversal, use it as timeout, so can return with result 0 (no events);
* | | [enhancement] extend "vwait" with same options as "update", new syntax ↵sebres2017-07-035-74/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "vwait ?options? ?timeout? varname". some small improvements and fixing: - Tcl_DoOneEvent can wait for block time that was set with Tcl_SetMaxBlockTime outside an event source traversal, and stop waiting if Tcl_SetMaxBlockTime was called outside an event source (another event occurs and interrupt waiting loop), etc; - safer more precise pre-lookup by options (use TclObjIsIndexOfTable instead of simply comparison of type with tclIndexType); test cases extended to cover conditional "vwait" usage;
* | | interim commit: try to extend "vwait" with same options as "update" sebres2017-07-031-53/+113
| | |
* | | [performance] do one event (update / event servicing) cycle optimized ↵sebres2017-07-035-65/+269
| | | | | | | | | | | | | | | | | | | | | (introduced threshold to prevent sourcing resp. waiting for new events by no-wait). [enhancement] new event type introduced: TCL_ASYNC_EVENTS, command "update" becomes options to process only specified types, resp. to bypass some event types (including -idle/-noidle that in opposite to "idletasks" does not included window events); test cases extended.
* | | command "vwait" extended with timeout argument (in ms), 0 could be used to ↵sebres2017-07-031-8/+67
| | | | | | | | | | | | | | | | | | process pending events only (without wait), negative value equivalent execution of "vwait" without timeout (infinite); test cases fixed and extended;
* | | [performance] much better handling for timer events within Tcl_ServiceEvent ↵sebres2017-07-034-138/+51
| | | | | | | | | | | | | | | | | | using timer marker in the queue and direct call of TclServiceTimerEvents if marker reached (instead of continuous adding handler event, polling it in the queue and removing hereafter); this provides double performance increase in the service cycle;
* | | [performance] large performance increase by event servicing cycles (3x - 5x ↵sebres2017-07-034-144/+207
| | | | | | | | | | | | | | | | | | | | | | | | faster now); [win] prevent listen using PeekMessage twice, and no wait anymore for too short timeouts (because windows can wait too long), compare 0µs with up-to 100µs overhead within MsgWaitForMultipleObjectsEx; [bad behavior] process idle events only as long as no other events available (now TclPeekEventQueued will be used to check new events are available in service idle cycle); [enhancement] new option "noidletasks" for command "update", so "update noidle" means "process all events but not idle";
* | | [performance] introduced additional queue for prompt timer events (after 0) ↵sebres2017-07-034-262/+310
| | | | | | | | | | | | | | | | | | that should be executed immediately (no time); normalizes timer, prompt and idle events structures using common TimerEntry structure for all types;
* | | bug fix: wrong release of after-id tcl-object if it switch type (object leak) sebres2017-07-031-7/+13
| | |
* | | [bug/stable fix] don't execute TimerSetupProc directly (may be unwanted, ↵sebres2017-07-031-21/+55
| | | | | | | | | | | | | | | | | | | | | because changes the blocking time, also if TCL_TIMER_EVENTS|TCL_IDLE_EVENTS not set), so let do that within Tcl_DoOneEvent cycle only (we have registered an event source). [performance] optimization for "after 0" as immediately execution without time (invoke as soon as possible) - generation and invocation of such timers twice faster now. [performance] leave handler-event in the queue as long as pending timers still available (with expired time or immediate timers) by generation lock, resp. changed/not invalidated timer-queue) - so fewer event/allocations and guarantee to be executed within the next event cycle;
* | | after-id: introduced object of type "afterObjType" as self-referenced weak ↵sebres2017-07-031-29/+174
| | | | | | | | | | | | | | | | | | pointer to timer/idle event, used for fast access to the "after" event (cancel, info etc.); test cases extended to cover it additionally
* | | rewrite interpreter limit handling using new timer event handling (with ↵sebres2017-07-032-50/+59
| | | | | | | | | | | | delete callback)
* | | timer resp. idle events optimized: better handling using doubly linked ↵sebres2017-07-033-190/+418
| | | | | | | | | | | | lists, prevents allocating memory twice for the "after" events (use memory inside timer/idle event for the "after" structure), etc.
* | | [performance] after-event list optimized (interp-assoc switched to doubly ↵sebres2017-07-032-36/+53
| | | | | | | | | | | | linked list, because requires handling from both ends of the list)