r/Python • • Sep 09 '22

Discussion Async Python is not faster

https://calpaterson.com/async-python-is-not-faster.html
0 Upvotes

47 comments sorted by

View all comments

13

u/Salfiiii Sep 09 '22 edited Sep 10 '22

Your title is misleading.

Async might not be overwhelmingly faster - or even faster at all - for web frameworks, but definetly has use cases where it shines.

If you have to do a lot of isolated REST calls which you can prepare beforehand, you get major benefits from using async(io).

I’ve reduced a scripts runtime from 30 to 3 minutes by using concurrent, non blocking requests with asyncio. I even used a semaphore to only allow 10 concurrent requests, so there’s still potential left.

It added a little complexity though, but nothing to fancy if one read the python book about asyncio, which I can recommend.