5 ms·
It is interesting to me that none of the new NodeJS alternatives support multithreading. Why is that? Is it just a side-effect of using V8 engine for the heavy
by bheadmaster 3y ago
It is interesting to me that none of the new NodeJS alternatives support multithreading. Why is that?
Is it just a side-effect of using V8 engine for the heavy lifting, or is it some part of the ECMAScript specification which forbids multithreaded implementations of the language?
- epolanski 3y agoMultithreading is achieved through workers and the event based architecture, it's not the same, but we should rather discuss the pros/cons of it.
- bheadmaster 3y agoPros: Vertical scalability. Cons: All your async code becomes full of data races. I suppose adding multithreading to the Node ecosystem would be as hard (if not harder) than removing GIL from Python. At least Python has locking primitives. Node, as far as I know, has none.
- dvlsg 3y ago> Node, as far as I know, has none. Atomics are probably the closest. https://v8.dev/features/atomics https://v8.dev/features/atomics
- meowtimemania 3y agoIn what cases would you want multi-threading in javascript? I feel like most performance intensive nodejs modules drop down to c++ where real concurrency already exists. (e.g. sharp - https://sharp.pixelplumbing.com/api-utility#concurrency https://sharp.pixelplumbing.com/api-utility#concurrency)
- bheadmaster 3y ago> In what cases would you want multi-threading in javascript? In all of them - JavaScript is mostly used for asynchronous programs, which are easily parallelizable. There's no reason not to want multi-threading.