[issue25159] Regression in time to import a module

STINNER Victor report at bugs.python.org
Thu Oct 15 12:15:30 EDT 2015


STINNER Victor added the comment:

Importing a module looks slow to me. Importing a module which is a an *empty* .py file takes ~160 us.

$ python3 -I -m timeit -s "open('slow.py', 'wb').close(); import sys; import slow" "del sys.modules['slow']; import slow"
10000 loops, best of 3: 156 usec per loop

The difference betwen Python 3.4 and 3.5 is that enum.py imports indirectly more modules. The following two imports were added to types.py in Python 3.5:

import functools as _functools         
import collections.abc as _collections_abc

----------

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


More information about the Python-bugs-list mailing list