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

Importing is very slow #453

Open
carlosperate opened this issue Nov 22, 2024 · 4 comments
Open

Importing is very slow #453

carlosperate opened this issue Nov 22, 2024 · 4 comments

Comments

@carlosperate
Copy link

In my dev environment (Macbook Pro 2020 i7) importing atproto takes over 3 seconds with Python 3.10, 3.11 and 3.12.

I couldn't find mentions of this in the issue tracker, so I assume this is not as expected?

$ python --version
Python 3.12.1

$ time python -c "from atproto import Client"
________________________________________________________
Executed in    3.63 secs    fish           external
   usr time    3.00 secs    0.14 millis    3.00 secs
   sys time    0.32 secs    1.23 millis    0.32 secs
$ python --version
Python 3.11.0

$ time python -c "from atproto import Client"
________________________________________________________
Executed in    4.20 secs    fish           external
   usr time    3.50 secs  136.00 micros    3.50 secs
   sys time    0.34 secs  954.00 micros    0.34 secs
$ python --version
Python 3.10.8

$ time python -c "from atproto import Client"
________________________________________________________
Executed in    3.97 secs    fish           external
   usr time    3.60 secs    0.12 millis    3.60 secs
   sys time    0.22 secs    1.52 millis    0.21 secs

The Python 3.12 venv pip list output:

Package           Version
----------------- -----------
annotated-types   0.7.0
anyio             4.6.2.post1
atproto           0.0.55
certifi           2024.8.30
cffi              1.17.1
click             8.1.7
cryptography      43.0.3
dnspython         2.7.0
h11               0.14.0
httpcore          1.0.7
httpx             0.27.2
idna              3.10
libipld           3.0.0
pip               23.2.1
pycparser         2.22
pydantic          2.10.1
pydantic_core     2.27.1
sniffio           1.3.1
typing_extensions 4.12.2
websockets        13.1
@MarshalX
Copy link
Owner

This is know one :( and comes from pydantic #441

@MarshalX
Copy link
Owner

Try “from atproto import models”. Should be the same bad result. Client itself is not a problem

@carlosperate
Copy link
Author

Ah, sorry, I didn't realised there was a Discussions section in the repo as well.
Could the model imports be lazy loaded? Or is this something we need to live with until Pydantic had a chance to improve performance?

@endlisnis
Copy link

I have also noticed this. On my very fast dev system it takes 1.3 seconds, and on my raspberry pi 5, it takes about 4 seconds.

That's crazy slow.

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