4 ms·
Wow. What's the intuition for why python on top of libuv is 2x faster than node on top of libuv?
by cjbprime 11y ago
Wow. What's the intuition for why python on top of libuv is 2x faster than node on top of libuv?
- 1st1 11y agoTwo things I'd check first: 1. The benchmarks make servers generate a huge number of objects, so maybe, the GC is under too much pressure. 2. Another possibility is that the v8 JIT can't optimize some JS code in nodejs, or does a poor job. That said, only careful profiling can answer your question :)
- geekuillaume 11y agoI would be interested in seeing the performance difference in NodeJS TCP echo benchmark by using piping instead of reading/writing manually: socket.pipe(socket);
- fzaninotto 11y agoHow about clustering the Node server? By default, node uses only one process. Making the server use all available processes requires a bit more work (see https://nodejs.org/docs/latest/api/cluster.html https://nodejs.org/docs/latest/api/cluster.html or https://github.com/Unitech/pm2 https://github.com/Unitech/pm2) but will probably do more justice to Node.js vs Python.
- 1st1 11y ago> but will probably do more justice to Node.js vs Python. How so? Clustering for node just makes it run in several OS processes. You can (and should) do the same for Python code, it's easy.
- occasionalreedr 11y agoC Python uses ref counting, whereas Node/V8 uses GC. Ref counting schemes generally use much less memory and GC scans can be expensive when there's a lot of new data, as is the case for a web server.