4 ms·
Is Javascript considered to be fast? It might be close to as fast as it could given the inherent constraints of the language, but I would not call it fast in a
by stephc_int13 5y ago
Is Javascript considered to be fast?
It might be close to as fast as it could given the inherent constraints of the language, but I would not call it fast in a general way.
- servytor 5y agoJavascript is actually quite fast, on par with Java[0], but it is DOM manipulation that makes it seem so slow. [0]: https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/javascript.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- pantsforbirds 5y agoI mean there are a number of benchmarks where Node outperforms java if you look at the benchmark comparison: https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/javascript.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/.... The optimization work that goes into JS is actually really impressive and comes from most of the biggest tech companies.
- billfruit 5y agoAs per that list Java is still faster for most of the benchmarks. Massive effort has gone into the JVM too, for the last 20+ years.
- 5e92cb50239222b 5y agoNote also that these numbers include startup time, which is noticeably slower for JVM compared to node. If you're not restarting the server on every request (like the "serverless" nonsense does), a second more or less is not that important. I'd like to see sustained throughput comparison between those two.
- igouy 5y agoFor those tiny tiny programs 1/10th of a second JVM startup —- “Wtf kind of benchmark counts the jvm startup time?” https://benchmarksgame-team.pages.debian.net/benchmarksgame/sometimes-people-just-make-up-stuff.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- kaba0 5y agoYes, it is a quite fast for a managed language. For comparison, python is roughly 10x slower than it.
- asiachick 5y agoIt's interesting to see where they fail. I tried to parse the stackoverflow database (XML) using node. It was so slow as to be unusable (multiple hours). I did the same in python and it took minutes. Now of course I'm comparing libraries basically and I have no idea how poorly the node library was implemented but I'd be super curious to know if the this is something python excels as because of language features or if it's just poorly implemented libraries in node that make the difference.
- hajile 5y agoI'd bet it's because the Python library is actually just a thin wrapper around a C library. You can do that in node too via NAPI or you could compile to wasm and run there instead.
- irrational 5y agoI’ve been using JavaScript since 1997. The fact that you can ask this question makes me think you weren’t using JS in the first decade of the WWW. Frankly until Google came in and shook things up, JS was incredibly slow. Think 14.4k modem versus 1 gigabit fiber optic speed difference.