4 ms·
It was already pretty performant. The issue is as always runtime type checking. For serious stuff you really want that. Also, async everything is not fun. Simpl
by winrid 3y ago
It was already pretty performant. The issue is as always runtime type checking. For serious stuff you really want that. Also, async everything is not fun. Simple code executed in a thread pool or whatever is so much easier to reason about.
- chris222 3y agoWorker threads have been around for a bit: https://nodejs.org/api/worker_threads.html https://nodejs.org/api/worker_threads.html
- winrid 3y agoyes and slow AF. also nobody is gonna use worker threads without async to handle API requests in NodeJS - why would you use nodejs then?
- cypress66 3y ago> Simple code executed in a thread pool or whatever is so much easier to reason about. reply Hard disagree. It's much easier to reason about async await because you don't need to worry about preemption. You (generally) don't need mutexes or anything like that.
- winrid 3y agohard disagree. :) When do you have to worry about synchronization? You don't. Pull DB connection from pool, etc, done. Async await has colored functions, promises, and other atrocities. Even if I have some locking primitives somewhere I'll GLADLY take that over the fucking mess of async stack traces and code executed "next tick" with no trace.
- sgammon 3y agoPerformant in what sense?
- winrid 3y agoas in easy to handle tens of thousands requests a second with a few DB calls on a smallish server? do you want a PHD thesus on what performant means?
- sgammon 3y agoNode JS caps at less than 10K RPS...
- winrid 3y agooh what machine? with how many workers? doing what? search for "node" on this page: https://www.techempower.com/benchmarks/#section=data-r21 https://www.techempower.com/benchmarks/#section=data-r21
- sgammon 3y agoExpress, on Linux, with one worker because that's how you benchmark apples-to-apples. Node 20, with plenty of RAM and CPU, not that it uses it.
- sgammon 3y agoRather than searching "node" on TechEmpower I do my own comparative benchmarks in a given environment. Node always loses. Every time. To everything. It reliably loses to Java, Python, and even other JavaScript engines. Which is why I asked... performant compared to what?