Title: Python TKinter for Mac on latest 2.7.15 still extremely slow vs Windows
Type: performance Stage:
Components: macOS, Tkinter Versions: Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Michael Romero, ned.deily, ronaldoussoren, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2018-05-14 15:38 by Michael Romero, last changed 2018-05-30 23:50 by Michael Romero.

File name Uploaded Description Edit Michael Romero, 2018-05-14 15:40 A PAC-MAN implementation written for Python 2.7 by Berkeley for their A.I. course.
Messages (6)
msg316520 - (view) Author: Michael Romero (Michael Romero) Date: 2018-05-14 15:38

I have recently been working with a PAC-MAN project developed by Berkeley for their A.I. course.  My primary workstation is a Touchbar MBP (3.1ghz core i7 w/16gb RAM and an SSD).  I had noticed how PAC-MAN's performance would sort of... stutter, when running on my Mac, while performing incredibly quick on a nearby gaming computer.  I had previously believed it to be due to the differences in specs between systems.  This is not the case, however, as the performance of PAC-MAN is extremely quick even within a VM ran via Parallels on the same Macbook whose native python performance was extremely sluggish.

I have seen recent issues submitted here and supposedly resolved that are intended to address a performance issue with Tkinter and Mac OS/X.  While the underlying issue mentioned in those particular tickets may have been addressed, the overall performance difference between Mac and Windows (and perhaps others) with Tkinter on Mac has not been. 

The following URL includes the PAC-MAN implementation I'm referring to:

The link above contains another link to download the "".

After extraction, running "python" with a system running the most recent 2.7.15 64bit release (on a fully patched OS/X) will allow you to see the sluggish performance of PAC-MAN I'm describing when compared to the same exact codebase running on a Windows system (and perhaps linux, though I have not yet tried to run it there), on a Windows VM living on the same system.
msg316521 - (view) Author: Michael Romero (Michael Romero) Date: 2018-05-14 15:40
"" on will also display the same performance issue.
msg317044 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-05-18 18:00
Responses to the following might help anyone who works on this.

1. Is the relative performance only an issue on 2.7 and not 3.6+?

2. What are the 'recent issues here'?  What is different about your example code.

3. We prefer plain text .py files that can be viewed in a browser or downloaded and run.

4. We prefer minimal failing examples.  (Here, 'failing' means 'slow'.)  What particular tkinter functions run comparitively slow?
msg317162 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2018-05-20 10:40
Another note: we also prefer relatively small samples, the code in is quite large.

The reason to want a small example for this issue is that this would make it easier to check if the problem is on the Python side or on the Tk side (e.g., this might just be a problem in the macOS port for Tcl/Tk and therefore not something we can fix in the tkinter codebase).


And as this an issue involving Tkinter on macOS:

* What version of macOS are you using? "Is fully patched" the latest High Sierra?

* Which variant of the Python 2.7.15 installer did you use? 

  There are two different ones: a 32-bit/64-bit installer 
  and a 64-bit only installer.

* Did you install ActiveState Tcl/Tk (check if there is a Tk.framework
  in /Library/Frameworks)? If so, which version?
msg318229 - (view) Author: Michael Romero (Michael Romero) Date: 2018-05-30 23:44
I don't have a minimal failing example as is being requested. What I do have is the smallest version of the code published by Berkeley's AI course that I could find that allows easy demonstration of the issue.  "python" is enough to demonstrate the latency difference between the MacOS and Windows versions of Python. 

The specific calls causing the program to run slowly on MacOS I leave to this team to determine / resolve.
msg318230 - (view) Author: Michael Romero (Michael Romero) Date: 2018-05-30 23:50
* What version of macOS are you using? "Is fully patched" the latest High Sierra?
- I've tried the version bundled with MacOS fully patched high sierra, as well as versions downloaded from, Intel, and ActiveState.  They all demonstrate the slowness.

* Which variant of the Python 2.7.15 installer did you use? 
- I used the 64-bit only installer from during one test.  However, all versions I've tried on MacOS seem to demonstrate the issue.

* Did you install ActiveState Tcl/Tk (check if there is a Tk.framework
  in /Library/Frameworks)? If so, which version?
- I used the bundled version of ActiveState Tcl/Tk that came with the 64-bit only installer. I have also experimented with alternate versions of python that use a Tcl/Tk externally.  "8.5" is the version I see on my system now.
Date User Action Args
2018-05-30 23:50:11Michael Romerosetmessages: + msg318230
2018-05-30 23:44:49Michael Romerosetmessages: + msg318229
2018-05-20 10:40:51ronaldoussorensetmessages: + msg317162
2018-05-18 18:00:30terry.reedysetnosy: + terry.reedy, ned.deily, serhiy.storchaka, ronaldoussoren
messages: + msg317044
components: + macOS
2018-05-14 15:45:51Michael Romerosettype: performance
2018-05-14 15:40:36Michael Romerosetfiles: +

messages: + msg316521
2018-05-14 15:38:44Michael Romerocreate