3 ms·
>because the threaded code blocks. Python and Java threads don't block on I/O, only on CPU. Event loops (i.e. node) also block on CPU. AFAIK, node's advantage
by corford 9y ago
>because the threaded code blocks.
Python and Java threads don't block on I/O, only on CPU. Event loops (i.e. node) also block on CPU.
AFAIK, node's advantage over threads was just that it offered much higher concurrency for I/O constrained tasks for the same memory (and was easier to programme for people coming from the front-end world).
- int_19h 9y agoPython and Java threads block the thread on I/O. Which is wasteful, because you have a huge chunk of memory allocated for the stack of that thread, being reserved but not actually in use.
- corford 9y agoYep, hence node's advantage of offering much higher concurrency for the same memory usage.