News for hackers. Stuff that matters.
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.