By - fsou1
I mean, I actually kind of like nodejs but it’s clearly not sometime i would choose for cpu-intensive workloads.
Yes, and that's why you shouldn't use the same tool for every task/project.
I see several problems
First is the title. I lost brain cells reading it
However the second is when I jumped to the end and saw him use async and saw all the times being 1ms when it used to be 1K. Is he measuring how long it takes to start an async job? Because it doesn't seem like he's collecting any results
If thats true then this is really fucking stupid and nothing was actually fixed
Around the 4min mark he appears to be offloading the heavy work to a WebWorker, so real gains in processing the fast requests would make sense.
I'm not really on the "JS hate train", but lets be honest, JS workloads run slow. Painfully slow.
Using JS for CPU-intensive operations isn't a great choice to begin with.
I’ve learned too many quirks not to be on the JS hate train. I don’t know how anyone can take it seriously. Like they added arrow functions which should be interchangeable for normal functions except they’re not because “this” behaves differently. Who thought that was a funny idea?
In this particular case its because the "this" reference in the original functions are impossible to reason about because "this" can refer to entirely different things based on how its invoked. Its a source of a number of bugs and the reason why you often see workarounds like `var $this = this` in code using them. The arrow functions enclose the "this" reference they are declared in which makes them much easier to use in many situations.
> In this particular case its because the "this" reference in the original functions are impossible to reason about because "this" can refer to entirely different things based on how its invoked.
Yet another example of why JS is one of the stupidest languages ever designed. Its a miracle it became so widely used
jQuery was useful so long as we needed to support IE10 and below. With the death of that era it becomes much easier to drop jQuery. jQuery UI is still a really nice themeable lightweight drop in for many sites though.
>. I don’t know how anyone can take it seriously.
probably because it's the only language you can do proper full-stack development with. I rather remember some of its quirks instead of learning a completely new language and all its quirks...
Why would you create new syntax that's basically as verbose for no reason?
The fact that `this` is treated differently in them is the entire point.
It's so much nicer as well, unless you somehow love writing `.bind(this)` when passing functions around?
nodejs can do some decent number cunching since they added worker threads:
Now, you may say this is shit because the C++ implementation completes at under a second. Fair enough. The C++ implementation uses SIMD instructions, which I'd rather never deal with. Notably, F# and Java are at around 4s, which I don't consider poorly performing languages at all.
Have you looked at V8 and SM optimisations recently, or do you get all your performance talking points from YouTube and reddit?
the benchmark shows something else with multi-threaded node not that far away from modern multi-threaded java. I would assume the difference is much smaller in a single-threaded context.
Obviously not as fast as "proper" languages like Go, Java, Rust, C++. But it's plenty fast enough for most things. The biggest issue is multithreading kind of sucks.
Anyway it could be worse. Could be Python.
I want to like Lua, but they made so many design decisions that could have been reasonable in a vacuum but just seem arbitrarily different to me. Arrays start at 1, not 0? Zero is truthy? The not-equals operator? Dash-dash-bracket-bracket for comments? These all make sense in some context if you’re only doing Lua, but it just drives me bonkers trying to context switch between that and almost any other language. As a result I just can’t use Lua effectively and avoid it.
Literally what I picture every time I see this moronic statement made.
I can tell, I've obviously upset the basement trolls with that statement.
Let me guess, someone discovered that it uses one core and has GC ?
Nope, developing in NodeJS and know it's pros and cons
Guys if we wrap the fibonnaci in a promise then would it still be blocking?
Yes, because Promise itself does make any magic if there is still a sync call at the end.
However, if you offload the computation to a separate server (core) and await for a HTTP response (result), then it would unblock your execution thread.
The promise immediately begins execution, and there's nothing in the fibonacci function that returns control, so yeah, it's still blocking. It doesn't even go to the event queue, it executes directly from the constructor of the promise.
You can do Promise.any or Promise.race as a workaround though.
Nice bot copying comments