Emscripten and ASMjs

157 views Asked by At

Is Emscripten (or llvm compilers or transpilers) single purpose specifically used to convert c/c++ programs to JavaScript(ASMjs). Im reading places how ASMjs is going to be faster than direct JavaScript. And in my eyes therefore better than coding in straight javascript. But how will the program be faster than writing directly in JavaScript. How is this possible. Aren't programs fastest when it can get straight to the main programs execution rather than having to be compiled first

1

There are 1 answers

0
Sanch On

ASM.js is optimized JavaScript, which is what makes it faster than writing directly in Javascript. That's really all there is to it.

The compilation step is something that would happen to convert C/C++ and produce the ASM.js source, which would then be given to browsers, etc. It wouldn't need to be recompiled unless the source changed, so therefore there is no compilation step when the ASM.js is part of a web application.