-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Switching to aiohttp? #4560
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
Comments
There's an another option that can be considered. |
Hi. Sorry for the late reply. I would like to point out that PTB is already designed such that it's easy to use a custom networking backend, see this wiki entry as well as the docs of After discussion in the dev chat, we're not (yet?) prepared to add additional network backends directly in PTB or completely replacing If these alternative implementations gain some traction and can maybe even be shown to also perform better than Let me know what you think. |
That would be great. So I would really appreciate it if any of the devs could implement a better one in ptbcontrib Thanks EDIT: I updated the code above, and now the errors are handled as expected :) |
Thanks @mamad0901-sys, |
Hey. I admit that I had forgotten this thread a bit :/ @mamad0901-sys you're welcome to send a PR against |
What kind of feature are you missing? Where do you notice a shortcoming of PTB?
Performance Improvement
Hi
Thanks for this great project.
Are there any plans to switch to aiohttp in future?
Describe the solution you'd like
It seems like aiohttp performs faster in async projects (specially the ones with high volumes of traffic).
There are some benchmarks that prove this:
For example this one from 2020 suggests that aiohttp performs faster in both single-request and multiple-requests sessions:
encode/httpx#838
The code used in the test above seemed very simple and logical, so I reran it with the latest versions of both modules on my own machine and got the same results in favor of aiohttp:
aiohttp
httpx
Therefore httpx is about two to three times slower when re-using a session for requests. My results too showed even more slower performance of httpx in single-request sessions (which is not very important in this project)
Other than speed differences, it might even suggest that aiohttp uses less resources like CPU too (maybe).
Thanks
Describe alternatives you've considered
Using aiohttp
Additional context
No response
The text was updated successfully, but these errors were encountered: