[New-bugs-announce] [issue27534] IDLE: Reduce number and time for user process imports

Terry J. Reedy report at bugs.python.org
Sat Jul 16 19:19:16 EDT 2016


New submission from Terry J. Reedy:

This issue continues #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 #25507 fix unnecessary.

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

This commit for #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.

----------
assignee: terry.reedy
components: IDLE
files: run_autocomplete.diff
keywords: patch
messages: 270592
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE: Reduce number and time for user process imports
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file43759/run_autocomplete.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27534>
_______________________________________


More information about the New-bugs-announce mailing list