Terry J. Reedy <[email protected]> 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 <[email protected]>
<https://bugs.python.org/issue35196>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com