python / cpython

The Python programming language
https://www.python.org
Other
62.15k stars 29.86k forks source link

Python TKinter for Mac on latest 2.7.15 still extremely slow vs Windows #77681

Closed bfad58ac-eb4d-4b9d-b826-9c1daded56b6 closed 4 years ago

bfad58ac-eb4d-4b9d-b826-9c1daded56b6 commented 6 years ago
BPO 33500
Nosy @terryjreedy, @ronaldoussoren, @ned-deily, @zware, @serhiy-storchaka
Files
  • search.zip: A PAC-MAN implementation written for Python 2.7 by Berkeley for their A.I. course.
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = created_at = labels = ['OS-mac', 'expert-tkinter', 'performance'] title = 'Python TKinter for Mac on latest 2.7.15 still extremely slow vs Windows' updated_at = user = 'https://bugs.python.org/MichaelRomero' ``` bugs.python.org fields: ```python activity = actor = 'zach.ware' assignee = 'none' closed = True closed_date = closer = 'zach.ware' components = ['macOS', 'Tkinter'] creation = creator = 'Michael Romero' dependencies = [] files = ['47587'] hgrepos = [] issue_num = 33500 keywords = [] message_count = 7.0 messages = ['316520', '316521', '317044', '317162', '318229', '318230', '367374'] nosy_count = 6.0 nosy_names = ['terry.reedy', 'ronaldoussoren', 'ned.deily', 'zach.ware', 'serhiy.storchaka', 'Michael Romero'] pr_nums = [] priority = 'normal' resolution = 'out of date' stage = 'resolved' status = 'closed' superseder = None type = 'performance' url = 'https://bugs.python.org/issue33500' versions = ['Python 2.7'] ```

    bfad58ac-eb4d-4b9d-b826-9c1daded56b6 commented 6 years ago

    Hello,

    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: http://ai.berkeley.edu/project_log.html

    The link above contains another link to download the "multiagent.zip". https://s3-us-west-2.amazonaws.com/cs188websitecontent/projects/release/multiagent/v1/002/multiagent.zip

    After extraction, running "python pacman.py" 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.

    bfad58ac-eb4d-4b9d-b826-9c1daded56b6 commented 6 years ago

    "search.zip" on http://ai.berkeley.edu/project_log.html will also display the same performance issue.

    terryjreedy commented 6 years ago

    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?

    ronaldoussoren commented 6 years ago

    Another note: we also prefer relatively small samples, the code in search.zip 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:

    bfad58ac-eb4d-4b9d-b826-9c1daded56b6 commented 6 years ago

    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 pacman.py" 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.

    bfad58ac-eb4d-4b9d-b826-9c1daded56b6 commented 6 years ago
    zware commented 4 years ago

    As Python 2.7 has now reached end-of-life, I'm closing the issue.