Compiling LLJS to asm.js
21–30 of 35 posts
Re: Compiling LLJS to asm.js
#22I am sure there is some reason this can't be done, but can we compile JavaScript to asm.js? If this can be done with C, it can be done with JS?
See this project, which compiles SpiderMonkey to javascript via emscripten, which supports asm.js: https://github.com/jterrace/js.js/
Re: Compiling LLJS to asm.js
#23Yesterday I rewrote a tiny Javascript demo in asm.js and also saw an order-of-magnitude speedup. (I thought at first it didn't help at all, apparently because the framerate was limited by setInterval().) Code at http://wry.me/hacking/canvas_asm.html
Can you tell me, how did you confirm you wrote valid asm.js and there was no fallback-mechanism kicking in?
I benchmarked my implementation, of course, and noticed a 2x speedup. However, this seems quite less for the this type of low-level algorithm...
Re: Compiling LLJS to asm.js
#24Yesterday I rewrote a tiny Javascript demo in asm.js and also saw an order-of-magnitude speedup. (I thought at first it didn't help at all, apparently because the framerate was limited by setInterval().) Code at http://wry.me/hacking/canvas_asm.html
Cool. I recently wrote a low-level sha1 implementation in pure javascript, trying to leverage asm.js ( http://github.com/srijs/rusha ). Can you tell me, how did you confirm you wrote valid asm.js and there was no fallback-mechanism kicking in? I benchmarked my implementation, of course, and noticed a 2x speedup. However, this seems quite less for the this type of low-level algorithm...
P.S. Looking at your code, I can tell it's not asm.js conformant yet, though it should just be a bunch of small tweaks (e.g. an expression like (a+b) will need to be (a+b)|0, etc.).
Re: Compiling LLJS to asm.js
#25I am sure there is some reason this can't be done, but can we compile JavaScript to asm.js? If this can be done with C, it can be done with JS?
Sure, but it's different because you need to compile a whole VM to asm.js and run javascript inside of it. You can't compile a dynamic language like javascript to low-level code because you need too much information at runtime. See this project, which compiles SpiderMonkey to javascript via emscripten, which supports asm.js: https://github.com/jterrace/js.js/
Re: Compiling LLJS to asm.js
#26Yesterday I rewrote a tiny Javascript demo in asm.js and also saw an order-of-magnitude speedup. (I thought at first it didn't help at all, apparently because the framerate was limited by setInterval().) Code at http://wry.me/hacking/canvas_asm.html
Re: Compiling LLJS to asm.js
#27Earlier quoted context omitted.
Cool. I recently wrote a low-level sha1 implementation in pure javascript, trying to leverage asm.js ( http://github.com/srijs/rusha ). Can you tell me, how did you confirm you wrote valid asm.js and there was no fallback-mechanism kicking in? I benchmarked my implementation, of course, and noticed a 2x speedup. However, this seems quite less for the this type of low-level algorithm...
Open the error console (via the Web Developer menu item) and you'll see messages there. Success shows up as "Error: successfully compiled asm.js code." :-) P.S. Looking at your code, I can tell it's not asm.js conformant yet, though it should just be a bunch of small tweaks (e.g. an expression like (a+b) will need to be (a+b)|0, etc.).
asm.js is very exciting technology!
Re: Compiling LLJS to asm.js
#28Earlier quoted context omitted.
Open the error console (via the Web Developer menu item) and you'll see messages there. Success shows up as "Error: successfully compiled asm.js code." :-) P.S. Looking at your code, I can tell it's not asm.js conformant yet, though it should just be a bunch of small tweaks (e.g. an expression like (a+b) will need to be (a+b)|0, etc.).
Thank you. I just updated my code and it's really within half of native speed now... (benchmarks in the README, if any of you are interested) asm.js is very exciting technology!
Re: Compiling LLJS to asm.js
#29Re: Compiling LLJS to asm.js
#30LLJS, asm.js, & Emscripten are really moving Javascript forward at incredible speed. I wonder if these projects will affect the future of the JS spec (ECMAScript Harmony + above). It's an exciting time to be a web programmer.