jwagner / simplex-noise.js

A fast simplex noise implementation in Javascript / Typescript.
MIT License
1.62k stars 130 forks source link

asm.js support #5

Closed deathcap closed 10 years ago

deathcap commented 10 years ago

Any interest in porting this module to use asm.js for potentially better performance? Seems like a good fit (pure math).

I've started to.. my progress is available at https://github.com/deathcap/simplex-noise.js/tree/asm - only for noise2D at the moment, produces identical output as the original implementation (unit tests added) + successfully links as asm.js in Firefox.

Unfortunately, benchmarks show the asm.js version is drastically slower: http://jsperf.com/simplex-noise-comparison-asm (haven't yet tracked down why, exactly; very new to asm).

jwagner commented 10 years ago

Any interest in porting this module to use asm.js for potentially better performance? Seems like a good fit (pure math).

In my opinion asm.js is mostly interesting as a target for compilers. It's a pita for us humans. Also I'm not sure if calling asm.js code from non asm.js code has an additional overhead and/or won't be inlined properly. If it was significantly faster in the real world, it would be interesting. But for now I'm really not convinced.

(haven't yet tracked down why, exactly; very new to asm).

It could be that there actually is a boundary.

In any case it is a very interesting experiment. Keep me up to date if you find out something new. :)