4 ms·
JS is not slow; remember that big JS engines are stupidly optimized.
by lionkor 2y ago
JS is not slow; remember that big JS engines are stupidly optimized.
- pjmlp 2y agoIt kind of is, when compared with native compiled languages, hence why rewriting JavaScript tooling is the new fashion is JS world.
- Asraelite 2y agoYou're underestimating the insane amount of engineering effort Google has put into optimizing V8. Take a look at some benchmarks. https://programming-language-benchmarks.vercel.app/javascript-vs-csharp https://programming-language-benchmarks.vercel.app/javascrip... https://programming-language-benchmarks.vercel.app/javascript-vs-java https://programming-language-benchmarks.vercel.app/javascrip... https://programming-language-benchmarks.vercel.app/javascript-vs-cpp https://programming-language-benchmarks.vercel.app/javascrip... It beats Java and C# in many of them, and for C++ it's usually not more than 5x slower. Of course, that's all optimized JavaScript. It's a lot easier to slip up and accidentally make your code much slower in a scripting language than in a compiled language. So yeah, for larger programs it's definitely worth rewriting.
- pjmlp 2y agoYou obviously don't know my comment history regarding dynamic languages and JIT compilers. If only CPython was half as fast as V8, or if PyPy wasn't a black swan in the community. Still doesn't change the point I made.
- neonsunset 2y agoIf you run the benchmarks longer (i.e. more than a couple hundred milliseconds - the above benchmarks use validation values from the original benchmarksgame, not the ones used for evaluating performance), you will see a different picture: https://benchmarksgame-team.pages.debian.net/benchmarksgame/box-plot-summary-charts.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/javavm-node.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... (and this is, by far, the most favorable comparison for Node.js you can make, where it can trade punches but ultimately ends up losing) Sure, V8 is impressive, but there is no free lunch especially when your optimization target is a dynamically typed, initially interpreted, language.