Skip to content
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

Slow to start #603

Closed
lapo-luchini opened this issue Aug 24, 2017 · 4 comments
Closed

Slow to start #603

lapo-luchini opened this issue Aug 24, 2017 · 4 comments

Comments

@lapo-luchini
Copy link

Seems that loading the openssl backend takes a lot of time (2 to 6 seconds on my system), I'm not expert of Python but maybe it could be loaded lazily?

$ python -v /usr/local/lib/python2.7/site-packages/httpie/cli.py 2>&1 | gawk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0 }'
[2017-08-24 13:16:50] import cryptography.hazmat.backends.openssl.backend # precompiled from /usr/local/lib/python2.7/site-packages/cryptography/hazmat/back
[2017-08-24 13:16:50] # /usr/local/lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/ciphers.pyc matches /usr/local/lib/python2.7/site-packag
[2017-08-24 13:16:50] import cryptography.hazmat.backends.openssl.ciphers # precompiled from /usr/local/lib/python2.7/site-packages/cryptography/hazmat/back
[2017-08-24 13:16:56] import cryptography.hazmat.primitives.ciphers # directory /usr/local/lib/python2.7/site-packages/cryptography/hazmat/primitives/cipher
[2017-08-24 13:16:56] # /usr/local/lib/python2.7/site-packages/cryptography/hazmat/primitives/ciphers/__init__.pyc matches /usr/local/lib/python2.7/site-pac
[2017-08-24 13:16:56] import cryptography.hazmat.primitives.ciphers # precompiled from /usr/local/lib/python2.7/site-packages/cryptography/hazmat/primitives
@sigmavirus24
Copy link

It's not loaded by httpie directly at all. There has been work to improve this timing in all associated projects. Can you share the versions of the projects involved that you're using?

@lapo-luchini
Copy link
Author

lapo-luchini commented Aug 25, 2017

Oh, sorry, I didn't notice the incriminated library was included form elsewhere.
This seems to be the full path from that library to httpie package:

% pkg which /usr/local/lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/ciphers.py
/usr/local/lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/ciphers.py was installed by package py27-cryptography-1.7.2
% pkg info -r py27-cryptography-1.7.2
py27-cryptography-1.7.2:
        py27-openssl-16.2.0
        py27-urllib3-1.22
% pkg info -r py27-urllib3-1.22      
py27-urllib3-1.22:
        py27-requests-2.18.1_1
% pkg info -r py27-requests-2.18.1_1
py27-requests-2.18.1_1:
        py27-httpie-0.9.8

PS: I'm using FreeBSD 11.1/amd64, everything is installed (and updated) using official binary packages.

@jkbrzt
Copy link
Member

jkbrzt commented Aug 30, 2017

@lapo-luchini this is, sadly, a known issue. The best solution is to install HTTPie against Python 3.

@lapo-luchini
Copy link
Author

PS: now the (same) FreeBSD Port creates both the py27-httpie-0.9.8 and py36-httpie-0.9.8 binary packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants