r/javascript • • Apr 23 '19

Introducing Node.js 12

https://medium.com/@nodejs/introducing-node-js-12-76c41a1b3f3f
333 Upvotes

85 comments sorted by

View all comments

Show parent comments

4

u/cm9kZW8K Apr 23 '19

Having the whole ecosystem being non-blocking is just superior - it means there are no landmines hiding away. When using C++ to do async code, especially when you have a selection of 3rds party code, you are often timebombed by some path that ends up calling a blocking syscall. JS is largely free of that.

Threads also dont have very many valid use-cases. Especially when you can just as easily fork a separate process on a modern linux, there just arent many times where a thread is the right choice to do something. Other than making up for the weaknesses of local hard-drive IO, async style programming has largely displaced threaded programming because its significantly more efficient and less buggy.

it turns out that there are nearly no modern uses for threading that arent better solved with other techniques.

8

u/ryeguy Apr 23 '19

But lack of threads has nothing to do with async. Node could still have async-everything and threads. That's the point I was trying to make - it's not the lack of threads that's nice, it's the nonblocking nature of everything.

Threads are still very relevant when it comes to working on cpu bound tasks in a way that needs access to shared data. Again, this isn't related to async or not. I'm not saying Java-style thread-based concurrency is better than node's. I'm saying there's a world were we could have both, and it would give us more flexibility.

0

u/[deleted] Apr 24 '19

[deleted]

1

u/ryeguy Apr 24 '19 edited Apr 24 '19

Yes, I'm aware. What's your point? Are you going to argue that js is popular because it doesn't have or need synchronization primitives? That doesn't hold, how do you explain Go's success?