Issue 32946: Speed up import from non-packages (original) (raw)

Issue32946

Created on 2018-02-25 08:46 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5873 merged serhiy.storchaka,2018-02-25 09:05
Messages (2)
msg312781 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-02-25 08:46
The proposed PR optimizes "from ... import ..." from non-package modules. $ ./python -m perf timeit 'from locale import getlocale' Unpatched: Mean +- std dev: 811 ns +- 27 ns Patched: Mean +- std dev: 624 ns +- 17 ns Currently _bootstrap._handle_fromlist() is called which does nothing if the module is not a package, but adds an overhead of calling a Python function. The PR moves this check out of _handle_fromlist and avoid calling it if not needed.
msg313587 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-03-11 08:52
New changeset 4e2442505c5e9eec396dcef4d2e6bdd2b6f92fc9 by Serhiy Storchaka in branch 'master': bpo-32946: Speed up "from ... import ..." from non-packages. (GH-5873) https://github.com/python/cpython/commit/4e2442505c5e9eec396dcef4d2e6bdd2b6f92fc9
History
Date User Action Args
2022-04-11 14:58:58 admin set github: 77127
2018-03-11 08:58:13 serhiy.storchaka set status: open -> closedresolution: fixedstage: patch review -> resolved
2018-03-11 08:52:41 serhiy.storchaka set messages: +
2018-02-25 09:05:43 serhiy.storchaka set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest5646>
2018-02-25 08:46:54 serhiy.storchaka create