3 ms·
JavaScript performance is completely vendor specific. There's no reference implementation for a JavaScript VM. So, it's more useful to talk about, let's say, v
by 29athrowaway 6y ago
JavaScript performance is completely vendor specific. There's no reference implementation for a JavaScript VM.
So, it's more useful to talk about, let's say, v8 performance. Much of v8 performance is also version specific, and not all of it is documented.
Code running on v8 can be blazing fast, or it can be slow. It depends on whether the code can be "optimized" (JIT compiled) and kept that way (because code can also be "deoptimized", meaning, the jitted version gets thrown away).
With JavaScript, if you want to ensure your code always runs fast as it possibly can, you have to become acquainted with the rules behind optimization and deoptimization, and start tracing optimizations and deoptimizations to make sure that your code gets optimized, and stays optimized. This process can be time consuming and can make your JavaScript look non-idiomatic and less readable.
In the other hand, WebAssembly performance is easier to reason about with respect to what's described above.