-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using entry_points makes scuba slow #71
Comments
The analysis was done with this data: scuba_list_aliases.zip, generated by:
Using snakeviz, I see that most of this was due to And another 31 ms was spent on Why is this so slow? |
Upstream issue: pypa/setuptools#510 |
I wrote a tiny module called https://github.com/ninjaaron/fast-entry_points |
Thanks @ninjaaron! I'll have a look at that. |
Interesting: I noticed after installing scuba from testpypi using pip (version 8.1.2), that the bash completion was noticeably (and measurably) faster. It turns out that when installing a wheel ( #!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from scuba.__main__ import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main()) Now I read (pypa/pip#2874 (comment)):
I confirmed that installing via pip from an
But that doesn't appear to always be the case. sdist from pypiInstalling the latest release 1.7.0 (which was only released as an
pip install direct from sourceIf I install this from source using pip install local .whlHowever, doing the following:
gives the desired behavior. ...Sigh, the relationship between all of these projects is complex. |
Since my The only users that would be affected would be those installing directly from source (i.e. the Git repo). For those users, forcing a wheel installation will ensure the faster entry point:
In the meantime, this works:
Update 2: |
Yes, I've also been reading about the relationship of this horrible entry_point script and wheels. I've begun building my packages with To keep users from getting the slow entry_points script no matter how they install, I'm putting this after the bit where I import setuptools in all my packages with entry_points: try:
from urllib import request
except ImportError:
import urllib2 as request
fastep = request.urlopen('https://raw.githubusercontent.com/ninjaaron/fast-entry_points/master/fastentrypoints.py')
namespace = {}
exec(fastep.read(), namespace) It copies the monkey patch into memory from my repo and execs it (in it's own namespace, of course). You could try that, or fork the repo to ensure that you don't pull some kind of exploit code or... I don't know. I realize this solution is kind of crazy, but it's better than waiting an extra 400ms for pkg_resources to load. |
This is the reason why my bdist_wheel packages weren't being built. See: #71
This tests that scuba behaves as expected when installed as a wheel, which is needed for performance (see #71).
This tests that scuba behaves as expected when installed as a wheel, which is needed for performance (see #71).
Now that Travis is pushing wheels out to pypi, and I've updated the README for the unlikely source installations, I'm considering this issue resolved. Thanks for your feedback and moral support, @ninjaaron! |
After some searching, it turns out that the `distributions` key was put within the `on` key (which makes no sense) so that any changes to it would not be detected, since the value of `distributions` was defaulting to just "sdist". Thanks to this guy: JonathonReinhart/scuba#71 (comment)
While working on Bash completion #46, I noticed a delay as the completion script invoked scuba to get the aliases:
When installed (using
pip install .
to/usr/bin/scuba
):When running from source:
Of course, 90 ms to get the aliases could be improved, but what accounts for this ~130 ms difference in the installed version?
The text was updated successfully, but these errors were encountered: