-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
asm.js support #1
Comments
I've thought about asm.js too, but when I last looked at it it seemed quite difficult to make an efficient interface between the JS environment and the asm.js environment (e.g. passing arrays in/out of it, and also the - at the time - rather high function call overhead for asm.js). A proof-of-concept could be to compile Benchmark.cpp into asm.js-code (i.e. have the entire benchmark run on the asm.js side), to see how much that could gain us over the pure JS code. It should be a fairly representative test since the polyfill and the generic C++ code (e.g. generic/ArrayMathGeneric.cpp) are very similar in design. |
Oh, and on another note: The idea is of course that the API should be implemented natively in the browser client. By utilizing low level architecture dependent SIMD/assembler/prefetching/etc, and highly optimized libraries (such as Intel IPP and equivalents), you get a significant performance advantage over general purpose compiled code (be it g++ -Ofast or asm.js). On the other hand, while the pure js polyfill is certainly slower than an optimized native implementation, it's surprisingly fast. For several API methods, modern ECMAScript engines are roughly on par with g++ -O3, which is really nice to see. I think that the reason is that the methods in question are simple/tight loops using only a few registers and only primitive types - which is handled nicely by the JIT compilers. |
It would be great to improve the performance of the library by enabling asm.js.
One option would be to actually use emscripten to compile the ArrayMath C++ library to JS and see what happens. :)
The text was updated successfully, but these errors were encountered: