[issue35196] IDLE text squeezer is too aggressive and is slow

Terry J. Reedy report at bugs.python.org
Fri Nov 9 15:56:51 EST 2018


Terry J. Reedy <tjreedy at udel.edu> added the comment:

On my machine, 2.7.15 (without squeezing) and 3.7.1 (with squeezing) IDLE results (average seconds).

from timeit import timeit
timeit("print('nnn '*500)", number=10)  # Exp1: .0357, .0355
timeit("for i in range(500): print(i)", number=4)  # Exp2: 1.45, 1.70
timeit("print(*range(500))", number=4)  # Exp3: about 5*, 4.85

* 'from __future__ import print_function' does not work with timeit either as setup or part of statement, so I timed on 2.7 with my phone stopwatch. I actually got 5.1 twice but subtract at least .1 for my reaction time delay at the end.

Serhiy's first comment is about 500 very short lines (experiment 2) not being squeezed.  This surprised me.  Tal?

Experiments 2 versus 1 illustrate Serhiy's 2nd comment.  Experiements 3 (*range) versus 2 show that repeated writes to the same line are even slower.

There is a known issue with tk Text and long lines, and 2000 chars is more than long. In fact, using range(100, 100+n) (to have a uniform 4 chars per number), the slowdown shows by n=200 (800 chars).  My previous experiments have also shown that 'long' starts somewhere less than 1000.  tk 8.7, in alpha or beta stage, reportedly has a re-written Text widget that improves this issue.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35196>
_______________________________________


More information about the Python-bugs-list mailing list