Why does asm.js deteriorate performance?

Actually asm.js has not been created to write code by hand but only as result of a compilation from other languages. As far as I know there are no tools that validate the asm.js code.
Have you tried to write the code in C lang and use Emscripten to generate the asm.js code? I strongly suspect that the result would be quite different and optimized for asm.js.

I think that mixing typed and untyped vars you only add complexity without any benefits. On the contrary the “asm.js” code is more complex: I tried to parse the asm.js and the plain functions on jointjs.com/demos/javascript-ast and the results are:

  • the plain js function has 137 nodes and 746 tokens
  • the asm.js function has 235 nodes and 1252 tokens

I would say that if you have more instructions to execute in each loop it easily will be slower.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)