4 ms·
It is non trivial to share state between node threads. The state is shuffled around outside of the VM unlike go, Java, and c#. In those languages, the overhead
by nrjdhsbsid 10y ago
It is non trivial to share state between node threads. The state is shuffled around outside of the VM unlike go, Java, and c#. In those languages, the overhead of sharing a variable are basically zero.
In node you get sharing at basically the speed of TCP local sockets on the machine. So maybe 5GBps. With natively threaded languages you get sharing at the speed of the cpu cache, orders of magnitude faster
If performance is important enough that multithreading comes into play, don't use node.
- ilaksh 10y agoSee `webworker-threads`.
- nrjdhsbsid 10y agoThey don't share variables low level, so the problem remains. In Java and similar languages the variables are shared at the machine level, including atomics
- nrjdhsbsid 10y agoThey don't share variables low level, so the problem remains. In Java and similar languages the variables are shared at the machine level, including atomics