Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is my opinion:</p> <p>First and foremost, asm.js isn't really meant to be written by hand. Altough I say that It certainly is possible to write it as it has a validator. The unreal demo is something that has been compiled into asm.js with emscripten. It also doesn't need to interact with other code outside the code that gets compiled. So it generates highly optimized code because of the fact that the unreal demo is already highly optimized code in C++, It gets optimized by a compiler and then gets another run of optimisations through asm.js. </p> <p>Secondly, asm.js is actually only supported by firefox. Altough all other browsers can execute it but on most it still incurs a performance penalty. This penalty is if you compare asm.js code that does the same as normal javascript code. Just search <a href="http://jsperf.com">jsperf.com</a> for examples of this.</p> <p>Okay, This is some general guide lines about asm.js. Now let's talk about Three.js.</p> <p>Firstly, because THREE.js has to interact with usercode, it isn't easy to write an asm.js library because of it's many restrictions (no objects).</p> <p>Secondly, Three.js will not gain much performance a whole lot in performance for calculations where asm.js is strong in. But will gain more from future updates from the browsers. (for instance, the creation of typedarrays in chrome which is now a pain point in THREE.js is comming soon. <a href="https://codereview.chromium.org/22390008">V8 issue</a>)</p> <p>Thirdly, The code in asm.js needs to manage its own memory. Which would mean that THREE.js has to figure out a way to make a large apps work with limited memory. Or make every application very memory hungry.</p> <p>Fourth, comparing the unreal demo with three.js is a bit unfair due to the fact that three.js tries to allow everyone to write 3D apps while the unreal engine is a highly optimized engine for 3D games.</p> <p>As you've noticed, I'm mostly against asm.js in three.js. But that's becuase it's too early to tell what the best way to go is. There is a high probability that asm.js will get a place in three.js eventually but for more a limited use as renderer-only for instance. But for now, there are still too many unsolved questions around asm.js.</p> <p>But If you want to use asm.js and use C++, Then i recommend <a href="https://github.com/kripken/emscripten">emscripten</a> which was used to build the unreal demo.</p> <p>This is of course my opinion. But I think it somewhat represents what @Mr.doob and @WestLangley had in mind. And sorry about the long post.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload