News for hackers. Stuff that matters.
Re:"Optimizations should be added to V8" for the asm.js subs... by icebraining on Thursday March 28, 2013 @05:40AM (#5453963)
Doesn't this means Node.js would benefit from asm.js addition in V8 as well?

Probably, but why? asm.js is supposed to be a target for compilation, but if you can run Node, you have a better target: actual machine code.

Re:"Optimizations should be added to V8" for the asm.js subs... by sirn on Thursday March 28, 2013 @05:54AM (#5453990)
What I meant to say was not to use asm.js as target for compilation, but rather implementing performance-critical module in asm.js subset and get the extra performance out of V8. Sort of like how Rusha[1] did it.

[1]: https://github.com/srijs/rusha/commit/e435ccdd709b6a3374879c...

Re:"Optimizations should be added to V8" for the asm.js subs... by abecedarius on Thursday March 28, 2013 @11:11AM (#5455237)
Another example I posted yesterday: http://wry.me/hacking/Turing-Drawings/
Re:"Optimizations should be added to V8" for the asm.js subs... by grayrest on Thursday March 28, 2013 @07:02AM (#5454159)
Crossing the JS to C++ barrier is not free [1]. Compiling the C to asm.js allows everything to live in the VM and avoids this cost.

[1] https://github.com/felixge/faster-than-c is a talk by a longtime node contributor on this topic.

Re:"Optimizations should be added to V8" for the asm.js subs... by abecedarius on Thursday March 28, 2013 @11:14AM (#5455266)
Calling asm.js code is not free either, it's worth mentioning. I measured it at (very) roughly 2ms/call for the code I posted yesterday. (At asmjs.org they mention they intend to address this.)
Re:"Optimizations should be added to V8" for the asm.js subs... by erichocean on Thursday March 28, 2013 @01:50PM (#5456453)
2ms is obscenely slow for a no-op function call. If correct, that needs to be treated as a bug by the asm.js team.
Re:"Optimizations should be added to V8" for the asm.js subs... by abecedarius on Thursday March 28, 2013 @03:02PM (#5456951)
It's not a no-op, it has to check types and maybe convert representations, much like a C/C++ FFI (but with more freedom for the implementor, who's not committed to the C ABI, so there's potential to go faster than a C FFI).

But I agree it needs attention, and apparently so do the Firefox devs. In http://wry.me/hacking/Turing-Drawings/ the asm.js version ran much slower than the regular JS version, until I adapted it to make fewer calls. The slowness also makes some other uses I've thought of impractical.

(The figure I gave was not carefully measured; just enough to say "yep, that'd account for why this is amazingly slow".)

Re:"Optimizations should be added to V8" for the asm.js subs... by hugh4life on Thursday March 28, 2013 @07:44AM (#5454261)
It could help solve the cross platform extension problem. Windows users often get left out. This would make node.js more like java as a write once run anywhere platform.