3 ms·
> at least 2x faster than nodejs, gevent, as well as any other Python asynchronous framework I did not see any benchmarks in the repo to support this. How was
by ruffrey 10y ago
> at least 2x faster than nodejs, gevent, as well as any other Python asynchronous framework
I did not see any benchmarks in the repo to support this. How was this statistic determined?
- kevinastone 10y agoThe benchmark (simple echo server) results were right there in the blog post: http://magic.io/blog/uvloop-blazing-fast-python-networking/tcp-bench.html http://magic.io/blog/uvloop-blazing-fast-python-networking/t...
- 1st1 10y agoFor benchmarks we have a separate project on the GH: [1] -- you can run the benchmarks on a Linux box pretty easily. Here's an example output: [2] [1] https://github.com/MagicStack/vmbench https://github.com/MagicStack/vmbench [2] http://magic.io/blog/uvloop-blazing-fast-python-networking/tcp-bench.html http://magic.io/blog/uvloop-blazing-fast-python-networking/t...
- e12e 10y agoNot sure what you mean, the benchmark section lists ~40k packets/s for nodejs and asyncio, ~100k for uvloop (for 1KiB packages, similar difference for 10 and 100 KiB) - and ~20k req/s for nodejs, and ~37k for uvloop w/httptools. Interestingly, uvloop pulls ahead for 100KiB request size for the http case.
- danappelxx 10y agoBuilding 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.
- 1st1 10y ago> 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.
- danappelxx 10y ago>So development time wise, uvloop is much better. 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.
- Sean1708 10y ago> It seems to me, then, that this isn't really a fair comparison to node, is it? Isn't node written in C?
- danappelxx 10y agoYes, but JavaScript is still a dynamic, garbage collected language.
- 1st1 10y agoMost 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).
- alexchamberlain 10y agoI think the uvloop package is written in Cython, but the benchmarks just use Python.