Building on to this, how does it compare to raw libuv in c?Personally, I'm not surprised that python (especially cython) is faster than node in this case, but I still need to see how much less overhead there is to node.
> Building on to this, how does it compare to raw libuv in c?
Building something in C is very hard. uvloop wraps all libuv primitives in Python objects which know how to manage the memory safely (i.e. not to "free" something before libuv is done with it). So development time wise, uvloop is much better.
As for the performance, I guess you'd be able to squeeze another 5-15% if you write the echo server in C.
> I'm not surprised that python (especially cython) is faster than node in this case
Cython is a statically typed compiled language, it can be anywhere from 2x to 100x faster than CPython.
Yeah, I definitely get that. I'm just trying to see the smaller picture here.
>Cython is a statically typed compiled language, it can be anywhere from 2x to 100x faster than Python.
Ah, my bad for not knowing the difference between Cython and CPython. It seems to me, then, that this isn't really a fair comparison to node, is it? Naturally a statically typed language is going to be faster than a dynamic one. Good on you for including a comparison with Go, though.
Most of nodejs internals are in C++ on top of libuv. Only a thin layer of JS interfaces wrap that.
Python is also a dynamic, GCed language. uvloop is built with Cython, which uses the Python object model (and all of its overhead!), and CPython C-API extensively (so it's slower than a pure C program using libuv).