Home > database >  libuv vs asyncio (python)
libuv vs asyncio (python)

Time:12-23

I have been trying to find the difference in implementation of the uvloop and inbuilt asyncio that comes up with python. Apart from the fact that libuv the base of uvloop is written in c , there is no other factor that is mentioned in the web. I would like to know about the other factors that affect the asyncio [erfomance between them.

Also on a side-note this blog consists of performance difference stream and normal async io, isn't stream generated from the asyncio and thus dependent on each other?

CodePudding user response:

As you said, uvloop is written in Cython (equivalent to c) on top of libuv.

Writing code in Cython is almost guaranteed to give you a noticeable speed boost which is exactly what's happening here. No need for any other difference. It's much like numpy doing operations faster than writing normally in Python.


For your other question: The difference between asyncio and asyncio-streams is that streams are built on top of the basic asyncio.

Asyncio uses transports and protocols, the first responsible for writing to the socket, and the second for handling data received by the socket.

Streams are simple constructs built on top of both, and have an easier to use interface that mimics regular files or sockets.

  • Related