Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE: Reduce number and time for user process imports #71721

Open
terryjreedy opened this issue Jul 16, 2016 · 6 comments
Open

IDLE: Reduce number and time for user process imports #71721

terryjreedy opened this issue Jul 16, 2016 · 6 comments
Assignees
Labels
3.7 (EOL) end of life topic-IDLE type-feature A feature request or enhancement

Comments

@terryjreedy
Copy link
Member

BPO 27534
Nosy @terryjreedy, @csabella, @tonybaloney
PRs
  • bpo-27534: IDLE: Reduce number and time for user process imports #2011
  • Files
  • run_autocomplete.diff
  • 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:

    assignee = 'https://github.com/terryjreedy'
    closed_at = None
    created_at = <Date 2016-07-16.23:19:16.232>
    labels = ['expert-IDLE', 'type-feature', '3.7']
    title = 'IDLE: Reduce number and time for user process imports'
    updated_at = <Date 2020-07-12.09:17:16.221>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2020-07-12.09:17:16.221>
    actor = 'cheryl.sabella'
    assignee = 'terry.reedy'
    closed = False
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2016-07-16.23:19:16.232>
    creator = 'terry.reedy'
    dependencies = []
    files = ['43759']
    hgrepos = []
    issue_num = 27534
    keywords = ['patch']
    message_count = 6.0
    messages = ['270592', '295460', '295470', '295471', '341654', '373550']
    nosy_count = 3.0
    nosy_names = ['terry.reedy', 'cheryl.sabella', 'anthonypjshaw']
    pr_nums = ['2011']
    priority = 'normal'
    resolution = None
    stage = 'needs patch'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue27534'
    versions = ['Python 3.6', 'Python 3.7']

    @terryjreedy
    Copy link
    Member Author

    This issue continues bpo-25507. I still want to reduce the number of modules imported when run.py starts a user process and the time they require. In the process, I expect to reduce the number of tkinter module imports that need to be reversed and thereby make parts of the bpo-25507 fix unnecessary.

    "New changeset 93d325c64104 by Terry Jan Reedy in branch 'default':
    Issue bpo-25507: Move 4 objects from pyshell to run and switch inports.
    https://hg.python.org/cpython/rev/93d325c64104"

    This commit for bpo-25507 was not needed for the fix I eventually choose, but it reduced the size of sys.modules in the user process from 193 to 156. I have since determined that it reduced the time for startup imports on my machine from .45 to .25 seconds. I now regard it as the first patch for this issue.

    The attached file was explained in msg270522. This and similar refactorings should be done when or after I have otherwise revised the module and tests in question.

    For a Windows build of repository 3.6, importing tkinter into a fresh python process increases len(sys.modules) from 41 to 65. But run only imports tkinter so it can call _tkinter.tkapp().eval('update') in its interactive input loop. If other indirect imports were eliminated, I suspect _tkinter could be imported instead.

    @terryjreedy terryjreedy self-assigned this Jul 16, 2016
    @terryjreedy terryjreedy added topic-IDLE type-feature A feature request or enhancement labels Jul 16, 2016
    @csabella
    Copy link
    Contributor

    csabella commented Jun 8, 2017

    Terry,

    I've applied this patch to 3.7 and made a pull request. This seemed like a fix you wanted to move forward with, so I hope that's helpful.

    @terryjreedy
    Copy link
    Member Author

    Yes, I do want to continue this. As I explained in msg270522, I shelved (but not abandoned) the autocomplete patch because it caused a test failure I did not (and do not) understand, and because I found another fix for that issue. The reductions I noted above were for the patch I did apply, not this one.

    Update: I just created pr_2011 and test_idle passes. I'm puzzled. I don't remember patching autocomplete since last July. Anyway, if the patch works, I can now decide if I really want to go this route. It makes sense to keep related functions together. It also makes sense to keep functions that run in the same process together. I should see if this patch has any noticeable benefit (time and import reduction) and if a similar patch for call tips works and has benefit.

    @terryjreedy terryjreedy added the 3.7 (EOL) end of life label Jun 8, 2017
    @csabella
    Copy link
    Contributor

    csabella commented Jun 8, 2017

    Yes, I ran test_idle before I submitted the pull request. I wasn't sure if I was missing something based on your comments of the test failing.

    @tonybaloney
    Copy link
    Mannequin

    tonybaloney mannequin commented May 6, 2019

    It would be great for this issue to be revisited, there has been some further interest from users.

    @csabella
    Copy link
    Contributor

    I'm going to close the PR for this as the change is out of date with newer changes to fetch_completions and fetch_completions is being rewritten for bpo-37766. It would be easiest to revisit this once the other changes to fetch_completions are set.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life topic-IDLE type-feature A feature request or enhancement
    Projects
    Status: In Progress
    Development

    No branches or pull requests

    2 participants