Asyncio and uvloop

Today, I read an article about uvloop. I am aware of libuv and its behind nodejs. What caught me was “In fact, it is at least 2x faster than any other Python asynchronous framework.”. So I decided to give it a try with aiohttp.

The test program was simple websocket code which receives a text message, doubles the content and echoes back. Here is the complete snippet with uvloop.

I ran naive benchmark using thor and results favoured uvloop.

If you haven’t tried asyncio, you should!