[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-04-22 Thread Aivar Annamaa


Aivar Annamaa  added the comment:

According to Tk people, the regression in performance was unavoidable and the 
solution is to avoid relying on update in a loop: 
https://core.tcl-lang.org/tk/tktview/f642d7c0f4

--
nosy: +Aivar.Annamaa

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-04-04 Thread Thomas Wamm


Thomas Wamm  added the comment:

I have forked my TerraLunar graphics program to make a simpler more portable 
version, called "TerraLunar-tkbench.py" to facilitate testing of the tkinter 
stack for graphics performance.  The project folder is at: 

https://github.com/ThomasWamm/TerraLunar-tkbench.git

The folder includes results and commentary from running the program on numerous 
platforms (MacOS, Windows10, Raspberry OS Linux) and Python versions.
Here are the most interesting summary results:

Apple M1 Mac Mini MacOS 11.2.3 (arm64 Apple Silicon, or Rosetta2 x86_64)

  Python 3.8.2Tcl/Tk 8.5.9  TerraLunar-tkbench 0.1.8  runtime = 37   (arm64)

  Python 3.8.7Tcl/Tk 8.6.8  TerraLunar-tkbench 0.1.8  runtime = 69   
(x86_64)

  Python 3.9.2Tcl/Tk 8.6.8  TerraLunar-tkbench 0.1.8  runtime = 69   
(x86_64)

* Python 3.10.0a6 Tcl/Tk 8.6.11 TerraLunar-tkbench 0.1.8  runtime = 421  
(arm64) *
*   Why is Tcl/Tk 8.6.11 on arm64 so slow?


old iMac24-2007  MacOS 10.11.6  on 2.4 GHz Intel Core 2 Duo (x86_64)

  Python 3.7.3 Tcl/Tk 8.6.8   TerraLunar-tkbench 0.1.8  runtime = 381
  Python 3.8.2 Tcl/Tk 8.6.8   TerraLunar-tkbench 0.1.8  runtime = 377
  Python 3.9.2 Tcl/Tk 8.6.8   TerraLunar-tkbench 0.1.8  runtime = 379

* Python 3.10.0a6  Tcl/Tk 8.6.11  TerraLunar-tkbench 0.1.8  runtime = 292 *
* this is faster than the M1 Mac, differing in silicon and MacOS version.


Dell laptop Windows10 i5-8250U  >= 1.6 GHz quad-core x86_64

  Python 3.9.2Tcl/Tk 8.6.9   TerraLunar-tkbench 0.1.8  runtime = 7
  Python 3.10.0a6 Tcl/Tk 8.6.10  TerraLunar-tkbench 0.1.8  runtime = 7

# Windows10 seems to be the best environment for tkinter.py / Tcl / Tk graphics 
apps.
--

Every Mac platform is sadly much slower than a comparable Windows platform, for 
tkinter graphics. But the new M1 Mac platform is the slowest by far, slower 
than even a much older Intel Mac running the same versions of Python 3.10.0a6 
and Tk 8.6.11

That's enough involvement for this noobie; I've now learned how complicated 
this performance issue is. It's not on my critical path, so I'm going back to 
my regular project far removed from tkinter graphics.  Good Luck folks!
...thomas

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-25 Thread Christopher A. Chavez


Change by Christopher A. Chavez :


--
nosy: +chrstphrchvz

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-24 Thread Thomas Wamm


Thomas Wamm  added the comment:

tkinter performance on Windows 10 looks okay, no obvious problems.

Attached is a transcript showing bench.py results for Pythons 3.8.2, 3.9.2, and 
3.10.0a6 on Windows 10 on a Dell laptop with an Intel i5-8250U CPU (medium good 
speed, a good comparison to Apple M1 Mac).

I originally raised this Issue because my new M1 Mac Mini performed so poorly 
compared to my Windows laptop, only for tkinter-related code.

--
Added file: 
https://bugs.python.org/file49913/results_tk-bench_Win10_i5-8250U.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-24 Thread E. Paine


E. Paine  added the comment:

As this appears to be a Tk issue, I have created 
https://core.tcl-lang.org/tk/tktview/f642d7c0f4.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-24 Thread E. Paine


E. Paine  added the comment:

> there appears to be a tk 8.6.11.1 release

This was the version I used when testing Wish on both MacOS and Linux.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-24 Thread E. Paine


E. Paine  added the comment:

The reduction in speed with later Tk versions does not seem to occur on Linux. 
See the below table (times are microseconds per iteration - tested using wish):

++--+--+
| Tk Version | clearing | not clearing |
++==+==+
| 8.6.8  | 197.7| 183.46   |
++--+--+
| 8.6.11 | 170.3| 201.6|
++--+--+

I have not tested on Windows but I don't think it's unreasonable to conclude 
the performance issue is limited to MacOS.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-24 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

One thing to look into: there appears to be a tk 8.6.11.1 release, I have no 
idea what changed in this micro release.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-24 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

If this is a Tk issue we should report it in their bug tracker.

I'm definitely against switching to an older version of Tk, the most recent 
release fixes a lot of problems with Tk on macOS.  Correctness before 
performance.

How bad is the performance compared to Tk on other platforms (with similar 
hardware)?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-24 Thread Thomas Wamm


Thomas Wamm  added the comment:

I ran the bench.py and bench.tcl programs from E. Paine (epaine) on my M1 Mac 
Mini.  Attached is a commented Terminal transcript.

The tl;dr summary again is that Python 3.10.0a6 arm64 for Apple silicon is 3 to 
100 times SLOWER than earlier pythons compiled for Intel x86-64 running with 
Rosetta2, when doing window operations thru Tcl/Tk.

I have not yet attempted to install any version of Tcl/Tk independent of any 
Python or Apple build.  I'm still learning slowly.  And I am inspired to re-jig 
my little TerraLunar graphics program to run with python2.7 arm64.

--
Added file: https://bugs.python.org/file49908/results-tkbench.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-23 Thread E. Paine


E. Paine  added the comment:

This *appears* to be a Tk issue. I ran a benchmark (see attached) which 
repeatedly performed canvas actions. The first test ("clearing") clears the 
canvas, creates a rectangle, then calls both `update` and `update_idletasks`. 
The second test ("not clearing") is the same as the above but did not clear the 
canvas (causing rectangles to be drawn over each other). Here is a table of the 
results (times are per iteration in milliseconds):

++-+-+
| Tk Version | Python  | Wish|
|+--+--+--+--+
|| clearing | not clearing | clearing | not clearing |
++==+==+==+==+
| 8.6.8  | 6.6  | 41.4 | 4.2  | 16.2 |
++--+--+--+--+
| 8.6.11 | 37.0 | 37.1 | 36.1 | 36.1 |
++--+--+--+--+

A few notes:
- These were performed on a slow machine and results could be influenced by 
background CPU usage fluctuations
- Because it is a slow computer, I limited the iterations to just 1000 per test.
- Python version was 3.9.2
- Wish 8.6.8 was installed using an ActiveTcl binary whereas 8.6.11 was 
installed through homebrew

--
Added file: https://bugs.python.org/file49905/tkbench.zip

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-23 Thread Thomas Wamm


Thomas Wamm  added the comment:

Failed tkinter tests were already noted in Issue 42507.
No mention of failures correlating with much slower testing.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-23 Thread Thomas Wamm


Thomas Wamm  added the comment:

Summary: "poor tkinter performance correlates with failed self-tests"

I'm an amateur hobbyist noobie programmer, so sophisticated testing is a 
challenge for me.  I raised this issue because I noticed Python graphics thru 
tkinter is especially slow on MacOS, and especially ultra-slow on my new M1 Mac 
Mini with Python 3.9.2 or 3.10.0a6 for Apple silicon. Aside from this weird 
issue, the M1 Mac outperforms all my other computers (including Win10 on 
i5-9500T, and Raspberry Pi 400). I'm expecting at least 10x performance 
improvement on M1 Macs when this issue gets resolved. 

Anyway, I looked under the hood.  I found some tkinter test programs runnable 
on MacOS with: 

/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/test/runtktests.py

The same program is buried in the Windows Python modules library, but was not 
findable in Python 3.7.3 for Linux on Raspberry Pi.

So I ran runtktests.py on Windows 10 and MacOS in many configurations. All was 
good EXCEPT Python 3.9.2 and 3.10.0a6 on old MacOS 10.11.6 and new MacOS 
11.2.3.  Those configs report about 10 Failed tests in a suite of over 1000 
tests, and interestingly the 3.9 and 3.10 tests run about 4x slower than the 
older Python 3.8 tests that reported zero failures.

So poor tkinter performance on MacOS correlates with failed tkinter self-tests. 
Maybe a more expert person could dig deeper?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The result of help('modules') depends on Python version. Do you have any 
example which does not depend on Python version?

Could you also run some pure Tcl/Tk demos to check whether the difference is in 
Tcl/Tk instead of the wrapper?

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-17 Thread Thomas Wamm


Thomas Wamm  added the comment:

I spent a few hours running numerous configurations (M1 Mac Mini, iMac24-2007, 
Win10 on i5-8250U, Raspberry Pi 4B, various Pythons from 3.7.3 to 3.10.0a6). It 
can get confusing. 
The primary interesting result is that Python 3.9.2 and 3.10.0a6 arm64 versions 
on M1 Mac Mini are the absolute worst performers by factors of 2 to 15, when 
relying on tkinter/Tcl/Tk for windows or graphics. Any Python3 on Windows 10 on 
an Intel i5 was at least 8x faster than the M1 Mac.  Intel Python 3.9.2 beats 
arm64 Python 3.9.2 or 3.10.0a6.  The problem is somewhere in the tkinter/Tcl/Tk 
layers or their connection to MacOS and arm64.  Python 3.7.3 on Raspberry OS 
(Linux) performs in the middle between slow MacOS and fast Windows.
The fastest configuration I found on the M1 Mac was Python 3.8.2 (Intel code) 
in combination with deprecated Tcl/Tk 8.5.9; that config was about 8x faster 
than 3.9.2 arm64 with Tcl/Tk 8.6.11.

The simplest qualitative performance test is just use 
>>> help('modules')   (in IDLE vs. python in a Terminal window) 
though my TerraLunar.py graphics program can give quantitative results.

The Turtle graphics demo programs in IDLE also perform slow on the M1 Mac.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43511] tkinter with Tk 8.6.11 is slow on macOS

2021-03-16 Thread Ned Deily


Ned Deily  added the comment:

Thanks for submitting a very interesting issue! tkinter/Tk performance is not 
something we normally pay a lot of attention to. I did not attempt to run your 
application but I was able to see significant performance differences with your 
simple "help('modules') test. Before saying more, I want to test some 
additional configurations but I've run out of time for today. However, the 
differences don't seem to have anything to do with running on new M1 Macs as I 
was able to see them on a traditional Intel-based Mac running macOS 11.

--
title: Tk 8.6.11 slow on M1 Mac Mini MacOS Python 3.9.2 native ARM version -> 
tkinter with Tk 8.6.11 is slow on macOS

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com