[1] https://www.techempower.com/benchmarks/#section=data-r19&hw=...
[2] https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
I think it's totally fair to compare node/js at least to Go. Go is quite simple: it's a GC language, almost without pitfalls except for nil and not error checking type conversions. It's really not unlike JavaScript in many aspects.
Also: node's performance is ok when passing small amounts of data per request. It's when you use it to serve files (images, videos in particular) or larger data tables that it loses steam. And it will take quite a bit of memory, though, unless you start optimizing.
Node is one of those environments that makes it easy to start a project, but difficult to bring it to fruition.
Pretty much every guide/tutorial/documentation says to not use node for this. Isn't this the same for a lot of languages like php, python, ruby, etc? Those all usually run behind a reverse proxy that handles file serving.
- But you can just use Typescript! Good, I like Typescript but what about some good web framework? You can use NestJS (https://nestjs.com/) which is amazing.
But if you step back, you see that you are basically writing C# that will transpile to JS. So then I just switched to .NET Core.
Backend performance is usually directly related to cloud resource costs.
Better have a compiled language, even if its within a VM, like C# or Java, rather than interpreted ones like JS or python.
I'm not sure you understand how these languages work as none of the are truly compiled in the sense I think you mean (natively). Both Java/C# and Javascript work in the same way: they are compiled to bytecode which is then interpreted. The only difference is that Java/C# is compiled AOT whereas V8 (presumably) compiles on first execution and caches the output. Python is a truly interpreted language although PyPy can give a huge perf boost.
For one, I am under the understanding that strongly typed languages like C# and Java, are optimally compiled to bytecode such that the overhead of running in a VM is minimal and performance is comparable to native code.
I maybe wrong, I dont have a up to date knowledge of JS runtime and optimizations, but for such a dynamic, loosely typed language, there is only so much AOT and optimization you can do. V8 might have bridged that gap a fair bit, but is nowhere close to performance of C#.
However, in almost all benchmarks, for real world use cases, .net always trumps JS runtimes.Also, a developer needs a high level of awareness and knowledge of underlying systems in JS to write performant code. The same is not true with C#, in the sense that as a seasoned developer, the strongly typed nature of C# mostly saves me from writing poorly performing code. I dont have to worry too much about underlying mechanisms in C#.
Edit : https://stackoverflow.com/questions/35457486/performance-and...
I found this. So, a program made for performance comparision between C# and JS would probably be equally fast in both. However, JS loses performance in real world due to its dynamic typing.
TypeScript is statically typed because of the type annotations and how the compiler checks the type compatibility between objects.
You may can consider TypeScript weakly-typed, because the TypeScript type information are not being encoded into the compilation result.
This is similar to C (being staticcally and weakly typed). You can print int as string and the compiler won't complain.
On the other hand, JavaScript is a dynamically typed and strongly typed language. It is strong as the types are encoded in the runtime. The proof is the keyword `typeof` and its ability to do Reflection.
Reference: Static vs Dynamic: https://en.wikipedia.org/wiki/Type_system#Type_checking Strong vs Weak: https://en.wikipedia.org/wiki/Strong_and_weak_typing
JavaScript has plenty of implicit conversions and will generally only halt execution if it literally cannot do something (like make a function out of `undefined` or the like), much like C, and is a weakly typed language.