Open jiasli opened 2 years ago
Good catch!
Hi @jiasli thank you very much for the study. Would you like to suggest any PRs tackling this issue?
For Python <= 3.12, _distutils_hack
is still necessary, but probably for Python >= 3.12
that can be an easy gain.
I think we can also delay the import of unittest.mock
in distutils/_msvccompiler.py
, but that would have to be addressed as a PR to the pypa/distutils
repository.
Currently the plan is to remove pkg_resources
and we have been working continuously on this direction (this should provide some performance improvements). Unfortunately, it is not something we can modify quickly.
Thanks lot @abravalheri for the analysis.
Would you like to suggest any PRs tackling this issue?
I would certainly like to, but sadly I am not an expert on the delicate implementation of Python infrastructures. 🤣
Currently the plan is to remove
pkg_resources
and we have been working continuously on this direction (this should provide some performance improvements). Unfortunately, it is not something we can modify quickly.
This will certainly make setuptools
significantly faster. We spent lots of effort getting rid of pkg_resources
(https://github.com/Azure/azure-cli/pull/14372, https://github.com/Azure/azure-cli/pull/14905), but now it's back via setuptools
. 😂
If setuptools
can be as fast as the old distutils
, that would really be helpful!
setuptools version
63.1.0
Python version
3.10.5
OS
Windows
Additional environment information
No response
Description
Importing
setuptools
is slow and takes nearly half a second. This imposes significant performance impact on CLI applications (https://github.com/Azure/azure-cli/issues/23177).Expected behavior
Importing
setuptools
should be fast.How to Reproduce
Output
Without
setuptools
, importingdistutils
is pretty fast: