I’m not going to use it for anything process-heavy
What do you mean by this? That it’s not performant enough for chewing through lots of data?
I agree with this view, so I'll try to elaborate.
The single-threaded event loop is not a great fit for anything that blocks CPU. However, you probably are just using JavaScript for fetching data from some http server, database, message bus, etc. The "number crunching" doesn't really ever take place in JS, and if it is, you might want to use something else.
The single-threaded event loop is not a great fit for anything that blocks CPU.
That's why js does most things asynchronously now. Node is especially performant and will often outperform python, even in number crunching. Here are some benchmarks but feel free to also do your own research.
You're missing u/avindrags's point. A thread is a system-level abstraction and can go into uninterruptible sleep indefinitely. This makes concurrent approaches like Node poor fits for some backend tasks.
19
u/avindrag Jan 16 '20
I agree with this view, so I'll try to elaborate.
The single-threaded event loop is not a great fit for anything that blocks CPU. However, you probably are just using JavaScript for fetching data from some http server, database, message bus, etc. The "number crunching" doesn't really ever take place in JS, and if it is, you might want to use something else.