3 ms·
Maybe I’m missing something here but surely Node isn’t doing anything concurrently? Promises don’t execute concurrently, they just tidy up async execution. The
by afavour 2y ago
Maybe I’m missing something here but surely Node isn’t doing anything concurrently? Promises don’t execute concurrently, they just tidy up async execution. The code as given will just sequentially resolve a million promises. No wonder it looks so good. You’d need to be using workers to actually do anything concurrently.
- charlotte-fyi 2y agoThat's not entirely true. There's a thread pool of workers underneath libuv. Tasks that would block do indeed execute concurrently.
- afavour 2y agoOh, I know. But the code used in this test doesn’t utilize that thread pool at all. It just uses setTimeout.
- Izkata 2y agoYou're thinking of parallelism. Concurrency doesn't require them to actually be running at the same time.
- afavour 2y agoFair point. Kind of makes the comparisons between languages a little unfair, though. Go and Rust would be executing these operations in parallel, Node would not. Would make a significant difference to real world performance!
- Izkata 2y agoThe measurement is memory, not performance. Paused/queued tasks in the sequential node version still count, and in theory could be worse since the Go and Rust ones would be consuming them in parallel and not building up the queue as much.
- lenkite 2y ago> The measurement is memory, not performance. But, then they can measure memory by simply using a threat pool of size 1 and then submitting tasks to it right ? That would be the equivalent comparison for other languages. They should launch a million NodeJS processes.
- deleted 2y ago[deleted]