I stumbled upon this interesting speed comparison of JavaScript and WebAssembly:
enter image description here
I wondered why the difference in speed is relatively low, I expected the speed difference to be in magnitude of hundreds. Doing the FFT (Fast-Fourier-Transform) algorithm the JavaScript code even seems to execute faster.
Other tests found on the web show similar results, many result in JavaScript and WebAssembly executing at roughly the same speed.
I am very surprised by this! Why wouldn’t code which is basically already machine code run magnitudes faster than JavaScript code, which has to be interpreted at runtime?