[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
STINNER Victor added the comment: New changeset 2c2a4f3d8545784c6e4ca8128bfc706916080712 by Victor Stinner in branch 'master': bpo-41006: What's New: less => fewer modules (GH-20955) https://github.com/python/cpython/commit/2c2a4f3d8545784c6e4ca8128bfc706916080712 -- __

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
STINNER Victor added the comment: New changeset 1bf7959dce0597e312c6f35476a7cc957fd0323c by Victor Stinner in branch 'master': bpo-41006: Remove init_sys_streams() hack (GH-20954) https://github.com/python/cpython/commit/1bf7959dce0597e312c6f35476a7cc957fd0323c -- _

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +20134 pull_request: https://github.com/python/cpython/pull/20955 ___ Python tracker ___ __

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +20133 pull_request: https://github.com/python/cpython/pull/20954 ___ Python tracker ___ __

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
STINNER Victor added the comment: New changeset 4c18fc8f1def7030e5ec5d1ffb9355d7453dc408 by Victor Stinner in branch 'master': bpo-41006: Document the runpy optimization (GH-20953) https://github.com/python/cpython/commit/4c18fc8f1def7030e5ec5d1ffb9355d7453dc408 --

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +20132 pull_request: https://github.com/python/cpython/pull/20953 ___ Python tracker ___ __

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
STINNER Victor added the comment: I close the issue. Making more imports lazy doesn't bring much benefit. -- With the 3 changes, runpy now imports 55 modules, instead of 70. The startup time is 1.3x faster, 18 ms instead of 24 ms: Mean +- std dev: [before] 23.7 ms +- 0.4 ms -> [after] 17.8

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
STINNER Victor added the comment: New changeset 9e09849d20987c131b28bcdd252e53440d4cd1b3 by Victor Stinner in branch 'master': bpo-41006: importlib.util no longer imports typing (GH-20938) https://github.com/python/cpython/commit/9e09849d20987c131b28bcdd252e53440d4cd1b3 --

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
STINNER Victor added the comment: New changeset 98ce7b107e6611d04dc35a4f5b02ea215ef122cf by Victor Stinner in branch 'master': bpo-41006: pkgutil imports lazily re (GH-20939) https://github.com/python/cpython/commit/98ce7b107e6611d04dc35a4f5b02ea215ef122cf -- __

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
STINNER Victor added the comment: New changeset 7824cc05bfe7f8181b21848a52007ddaf5612b9b by Victor Stinner in branch 'master': bpo-41006: collections imports lazily heap (GH-20940) https://github.com/python/cpython/commit/7824cc05bfe7f8181b21848a52007ddaf5612b9b --

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
STINNER Victor added the comment: I created 3 PRs. I have a few more local branches to avoid types and itertools imports. I may create PRs for these ones as well. -- ___ Python tracker _

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread hai shi
Change by hai shi : -- nosy: +shihai1991 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-40275: "test.support has way too many imports". -- ___ Python tracker ___ ___ Python

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +20121 pull_request: https://github.com/python/cpython/pull/20940 ___ Python tracker ___ __

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +20119 pull_request: https://github.com/python/cpython/pull/20939 ___ Python tracker ___ __

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
STINNER Victor added the comment: > Currently, runpy imports +21 modules: > * ./python mod.py: Total 33 > * ./python -m mod: Total 54 (+21) Oops sorry, that's with my local changes! Currently, runpy imports not less than 37 modules: * ./python mod.py: Total 33 * ./python -m mod: Total 70 (+3

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +20117 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20938 ___ Python tracker ___ _

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
STINNER Victor added the comment: My local changes removed the following imports from runpy: - '_heapq', - '_locale', - '_sre', - 'collections.abc', - 'copyreg', - 'enum', - 'heapq', - 'importlib.abc', - 'itertools', - 're', - 'sre_compile', - 'sre_constants', - 'sre_parse', - 'typing', - 'typ

[issue41006] Reduce number of modules imported by runpy

2020-06-17 Thread STINNER Victor
New submission from STINNER Victor : Currently, the runpy module imports many modules. runpy is used by "python3 -m module". I propose to attempt to reduce the number of imports to reduce Python startup time. With my local changes, I reduce Python startup time from 24 ms to 18 ms: Mean +- s