[issue27546] Integrate tkinter and asyncio (and async)

Terry J. Reedy report at bugs.python.org
Sat Jul 23 21:47:39 EDT 2016


Terry J. Reedy added the comment:

Speed tests:
First -- raw loops/second.  The attached loopspeed.py has code for tk and asyncio that is equivalent as I know how.  The tkasync loop is for the asyncio loop with a root.update() call added, where the root is a fresh instance of Tk().  (Reusing the old root resulted in the tk loop restarting.)
  tcl/tk loop:  13300 l/s
  asyncio loop: 14900 l/s
  tkasync loop: 10900 l/s (uncomment commented lines)
The two bare loops have a std.dev. of roughly around 100, with +- up to 300.  This suggests to me that the tcl loop might be written in tcl, not C.  This result reduces my motivation to write a tcl/tk based replacement for BaseEventLoop, thought I still might.

Second -- IDLE syntax highlighting speed.  I opened 9 idlelib files in installed 3.6.0a3 and patched repository 3.6.0a3+.  I switched between a light default and custom custom theme and hit apply.  For stock IDLE, it took 2 subjective mental 'thousand and one...' counts.  For patched IDLE, three.  Reducing the call_later delay from .01 to .001 reduced the count to about two and a half.  Replacing call_later with call_soon may have given a small further speedup.

Changing highlight theme (or changing font or font size, which trigger re-highlighting) with at least a few thousand lines of code to process, is sufficiently rare that a slowdown of 25% or less does not bother me.  When I want to try to experiment with using asyncio with IDLE, I will use the current patch until it proves not to work.  I am now thinking of this as perhaps just a doc issue.

----------
Added file: http://bugs.python.org/file43849/loopspeed.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27546>
_______________________________________


More information about the Python-bugs-list mailing list