Re:Why you can have millions of goroutines but only thousand...
by the_other_guy on Monday October 08, 2018 @09:35PM
(#18172724)
if it's about simplicity, then Javascript and Node are better at concurrency for me when it comes to I/O, Node is very performant too
[ Parent
| on HN ]
Re:Why you can have millions of goroutines but only thousand...
by exabrial on Monday October 08, 2018 @10:05PM
(#18172818)
Node is definitely not performant by any equal benchmark, but the async model does lend itself to simplicity in some cases in non-sequential workloads. But even then, it gets stomped by vert.x running on the jvm. I think the most valuable contribution is democratizing package management for SPAs as we move towards thick clients again.
Re:Why you can have millions of goroutines but only thousand...
by weberc2 on Monday October 08, 2018 @11:06PM
(#18173021)
I find goroutines and channels much easier to work with than promises, callbacks, or async/await, and the former can parallelize computation as well. Not to mention that Go is typically faster than Node in single-threaded execution.
Re:Why you can have millions of goroutines but only thousand...
by mikekchar on Tuesday October 09, 2018 @12:52AM
(#18173420)
You can easily implement channels in ES6. I've done it and my implementation is probably 40-50 lines of code. You can then use async/await to simulate go routines. It's actually a bit nicer than go because of the way async coordinates with promises. You can more easily synchronise the routines (for example in situations where you might need a wait group in go).
I keep expecting someone to write one and put it up on NPM (I haven't looked recently, though). Perhaps I should clean up my and stick it up there. It provides a very nice abstraction of continuations. I did it merely as kata to show that continuations do not require concurrency.
Re:Why you can have millions of goroutines but only thousand...
by spiralx on Tuesday October 09, 2018 @07:38AM
(#18175033)
I've read a few articles on implementing CSP in JavaScript, and there are definitely some packages available, e.g.
https://github.com/olahol/node-csp