MyThinkPond

On Java, Python, Groovy, Grails, Spring, Node.js, Linux, Arduino, ARM, Embedded Devices & Web

uvloop – Python replacement for asyncio event loop

Posted by Venkatt Guhesan on April 1, 2017

uvloop is a fast, drop-in replacement of the built-in asyncio event loop. uvloop is implemented in Cython and uses libuv under the hood.

Benefits: uvloop makes asyncio 2-4x faster.
Cons: uvloop is available from PyPI but it requires Python 3.5. (The reason for this is asyncio was introduced in Python 3.4 and above.) Unless your project is based on Python 3.4+ – you may not be able to leverage this library.
Alternatives: For the folks that are using Python 2.7 (including me), if you search for “asyncio alternatives” you will quickly come across the Trollius project. But unfortunately this project is no longer under development. Eventually, you will arrive a discussion on GIL and multi-cores like this article. Yes, the Python community is torn between 2.7 and 3.x. Your best bet at this point of time for Python 2.7 users is to leverage Tornado’s async facility using Callbacks, futures, promises and deferred.  A hybrid but elegant alternative is to use Cyclone (Takes Tornado’s elegance and applies it to Twisted library).

Read more about uvloop here: https://goo.gl/lEC7tt

To learn more about the other libraries mentioned here refer to this blog article:
https://goo.gl/TDkEkJ

Cheers!

Today’s inspirational quote:
bust_of_marcusaurelius
  • Letting go is a necessary, if sometimes heart-wrenching gateway to genuine transformation.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: