-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
Any "import pkg_resources" by a module is slow, in the 100-150ms range, depending on the system.
This is due to the number of modules imported by pkg_resources itself (email.parser is also slow), and side-effect work done at import time, notably the _initialize
and _initialize_master_working_set
functions at the bottom of pkg_resources/__init__.py
.
As wall clock time matters to humans running CLIs, every millisecond counts.
The work done at import time should be deferred until needed, and the imports themselves also deferred if possible.
tiran, alex, reaperhulk, trinhanhngoc, rawouter and 16 more