4 ms·
> As a scripting language, excluding all bindings (files, networking, etc), JavaScript is substantially faster than Ruby or Python. This makes no sense. They'
by hota_mazi 10y ago
> As a scripting language, excluding all bindings (files, networking, etc), JavaScript is substantially faster than Ruby or Python.
This makes no sense.
They're all dynamically typed languages (avoiding the term "scripting languages" since it's pretty vague).
The only reason for the difference in speeds between these languages is due to the quality of their interpreters, not the languages themselves.
- goatlover 10y agoYeah, since PyPy is V8 fast, LuaJit is faster, and Julia is even faster.
- partycoder 10y agoIf you have embedded or extended a scripting language it makes perfect sense. Repeating myself just for you: I was referring specifically to benchmarking language aspects excluding bindings to native code such as files, networking, processes, etc. e.g: https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=node&lang2=python3 https://benchmarksgame.alioth.debian.org/u64q/compare.php?la... Then sure, JavaScript has many implementations, so does Ruby and Python. I was referring to v8 (used by node), CPython and Ruby MRI in particular.
- dragonwriter 10y ago> The only reason for the difference in speeds between these languages is due to the quality of their interpreters, not the languages themselves. That's not entirely true; there've been fairly good write-ups on particular elements of language semantics for which support inhibits VM performance; for instance, there were particularly good write-ups a while back by the JRuby team (Charles Nutter, specifically, IIRC) on Ruby semantics that are problematic in that respect. Obviously, that doesn't mean that the level of investment by major firms in the interpreters doesn't have an impact, and Node is definitely riding high on Google's investment in making V8 speedy for Chrome. But language differences do matter.
- chickenfries 10y agoI'm not a PL expert, but Ruby's semantics seem much more complicated than JavaScript's.
- goatlover 10y agoPerhaps, but Ruby is are more consistent. There is no implicit conversion, no optional semicolons, no dynamic this, the inheritance chain is not disguised by Java-like syntax, everything is an object (there are no primitives), object construction is always uses the .new method, containers mixin Enumerate for a consistent API across arras, hashes, etc. There's no need for "use strict" or built-in statements like with to ignore. All operations are messages between objects. You can extend the semantics by defining message operation on an object, so that you can use + for more than the builtin classes, where it makes sense to do so.