News for hackers. Stuff that matters.
Re:Uvloop: Fast Python networking by ruffrey on Tuesday May 03, 2016 @11:26PM (#11625944)
> 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?

Re:Uvloop: Fast Python networking by 1st1 on Tuesday May 03, 2016 @11:32PM (#11625984)
For 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 [2] http://magic.io/blog/uvloop-blazing-fast-python-networking/t...

Re:Uvloop: Fast Python networking by e12e on Tuesday May 03, 2016 @11:41PM (#11626007)
Not 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.
Re:Uvloop: Fast Python networking by kevinastone on Tuesday May 03, 2016 @11:32PM (#11625982)
The benchmark (simple echo server) results were right there in the blog post:

http://magic.io/blog/uvloop-blazing-fast-python-networking/t...

Re:Uvloop: Fast Python networking by danappelxx on Tuesday May 03, 2016 @11:44PM (#11626017)
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.
Re:Uvloop: Fast Python networking by 1st1 on Wednesday May 04, 2016 @12:18AM (#11626156)
> 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.

Re:Uvloop: Fast Python networking by danappelxx on Wednesday May 04, 2016 @12:30AM (#11626204)
>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.

Re:Uvloop: Fast Python networking by Sean1708 on Wednesday May 04, 2016 @02:44AM (#11626637)
> It seems to me, then, that this isn't really a fair comparison to node, is it?

Isn't node written in C?

Re:Uvloop: Fast Python networking by danappelxx on Wednesday May 04, 2016 @11:06AM (#11628843)
Yes, but JavaScript is still a dynamic, garbage collected language.
Re:Uvloop: Fast Python networking by 1st1 on Wednesday May 04, 2016 @01:13PM (#11629832)
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).

Re:Uvloop: Fast Python networking by alexchamberlain on Wednesday May 04, 2016 @03:06AM (#11626707)
I think the uvloop package is written in Cython, but the benchmarks just use Python.