Author terry.reedy
Recipients rhettinger, taleinat, terry.reedy
Date 2018-11-09.20:56:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1541797011.33.0.788709270274.issue35196@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-11-09 20:56:51terry.reedysetrecipients: + terry.reedy, rhettinger, taleinat
2018-11-09 20:56:51terry.reedysetmessageid: <1541797011.33.0.788709270274.issue35196@psf.upfronthosting.co.za>
2018-11-09 20:56:51terry.reedylinkissue35196 messages
2018-11-09 20:56:51terry.reedycreate