[issue33902] entry_points/console_scripts is too slow

George King report at bugs.python.org
Tue Jun 19 10:34:17 EDT 2018


New submission from George King <george.w.king at gmail.com>:

On my newish macOS laptop using Python 3.6 or 3.7, a no-op script takes 3 times as long to invoke using the entry_points machinery as it does to invoke directly. Here are some exemplary times (best times after several tries).

$ time python3.6 entrypoint.py 

real	0m0.047s
user	0m0.033s
sys	0m0.010s

$ time python3.6 /Library/Frameworks/Python.framework/Versions/3.6/bin/entrypoint

real	0m0.153s
user	0m0.129s
sys	0m0.020s

In this example, entrypoint.py consists of `def main(): pass`; the second script is that generated by `pip3 install ...`. I have confirmed that the `-e` flag to pip is not the culprit.

I look at a cprofile trace of the invocation and I do not see an obvious single culprit, but I'm not an expert at reading such traces either.

I know that there has been some previous debate about "how slow is slow", whether to try to improve import times, etc. I'm not trying to fan any flames here, but from a practical perspective, this discrepancy is showing up in developer tools that I'm writing, and is driving me to abandon entry_points in favor of less standard, less cross-platform install hackery in my setup.py scripts. An extra 0.1s per invocation is visibly detrimental to shell scripts calling out to installed python programs.

----------
messages: 319971
nosy: gwk
priority: normal
severity: normal
status: open
title: entry_points/console_scripts is too slow

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33902>
_______________________________________


More information about the Python-bugs-list mailing list