diff options
author | sebres <sebres@users.sourceforge.net> | 2017-07-03 13:23:45 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2017-07-03 13:23:45 (GMT) |
commit | df949554f991f8fb4a399bdd248437012deebe40 (patch) | |
tree | 81ee1cffcddb95744155eaf3ba12e8e4941e3588 /generic/tclEvent.c | |
parent | f629f9d07d2b465bba72bc71df2d2c9d3856bca8 (diff) | |
download | tcl-df949554f991f8fb4a399bdd248437012deebe40.zip tcl-df949554f991f8fb4a399bdd248437012deebe40.tar.gz tcl-df949554f991f8fb4a399bdd248437012deebe40.tar.bz2 |
[performance] large performance increase by event servicing cycles (3x - 5x 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";
Diffstat (limited to 'generic/tclEvent.c')
-rw-r--r-- | generic/tclEvent.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 4db524c..85c564a 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1410,26 +1410,28 @@ Tcl_UpdateObjCmd( Tcl_Obj *CONST objv[]) /* Argument objects. */ { int optionIndex; - int flags = 0; /* Initialized to avoid compiler warning. */ - static CONST char *updateOptions[] = {"idletasks", NULL}; - enum updateOptions {REGEXP_IDLETASKS}; + int flags = TCL_ALL_EVENTS|TCL_DONT_WAIT; + static CONST char *updateOptions[] = {"idletasks", "noidletasks", NULL}; + enum updateOptions {UPDATE_IDLETASKS, UPDATE_NOIDLETASKS}; if (objc == 1) { - flags = TCL_ALL_EVENTS|TCL_DONT_WAIT; } else if (objc == 2) { if (Tcl_GetIndexFromObj(interp, objv[1], updateOptions, "option", 0, &optionIndex) != TCL_OK) { return TCL_ERROR; } switch ((enum updateOptions) optionIndex) { - case REGEXP_IDLETASKS: + case UPDATE_IDLETASKS: flags = TCL_WINDOW_EVENTS|TCL_IDLE_EVENTS|TCL_DONT_WAIT; break; + case UPDATE_NOIDLETASKS: + flags &= ~TCL_IDLE_EVENTS; + break; default: Tcl_Panic("Tcl_UpdateObjCmd: bad option index to UpdateOptions"); } } else { - Tcl_WrongNumArgs(interp, 1, objv, "?idletasks?"); + Tcl_WrongNumArgs(interp, 1, objv, "?option?"); return TCL_ERROR; } |