Asynchronous processing is more efficient -- surely not?

Paul Rudin paul.nospam at rudin.co.uk
Thu Apr 5 02:40:21 EDT 2018


Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:

> So, I'm, still trying to wrap my brain around async processing, and I 
> started reading this tutorial:
>
> http://stackabuse.com/python-async-await-tutorial/
>
> and the very first paragraph broke my brain.
>
> "Asynchronous programming has been gaining a lot of traction in the past 
> few years, and for good reason. Although it can be more difficult than 
> the traditional linear style, it is also much more efficient."
>
> I can agree with the first part of the first sentence (gaining a lot of 
> traction), and the first part of the second sentence (more difficult than 
> the traditional style), but the second part? Asynchronous processing is 
> *more efficient*?

<snippage>

It really depends on your definition of "efficient". Using async
generally introduces some overhead, so there's a cost. However it also
allows for the possibility of making better use of your compute
resources by doing useful work rather than idle-waiting for network
interactions to complete. 

As with many things - it's a useful tool and can be used to your
advantage, but you can also shoot yourself in the foot if used
inappropriately.



More information about the Python-list mailing list