14 ms·
As a node developer, I'm curious to know what if anything asm.js can do for node? Maybe I'm misunderstanding something, but wouldn't asm.js allow basically all
by aroman 14y ago
As a node developer, I'm curious to know what if anything asm.js can do for node? Maybe I'm misunderstanding something, but wouldn't asm.js allow basically all of node's core to be written in JavaScript itself, rather than in C/++? I think that would be a tremendous advantage, but maybe I'm missing part of the picture...
- jeresig 14y agoThat certainly could be a theoretical future for Asm.js! In my post I link to a pure-JavaScript port of SQLite that runs in Node.js (using Emscripten): https://github.com/kripken/sql.js https://github.com/kripken/sql.js Presumably either Node would have to switch to Mozilla's Spidermonkey or V8 would have to implement full performance support for Asm.js.
- tracker1 14y agoHopefully the V8 guys have more respect for asm.js than they do E4X, which would be really nice to have in NodeJS. Even though V8 is from Google devs and not directly associated with NodeJS, I think they should be at least considerate of features that are useful outside the browser, but need integration into the engine itself.
- Offler 14y agoV8 doesn't support Asm.js.
- aaronharder 14y ago...not yet, anyway.
- falcolas 14y ago... in an optimized fashion. Being valid JS, V8 could run Asm.js code.
- coldtea 14y agoWhich doesn't matter in this case, as this fact doesn't give any incentive to Node folks to use it in V8.
- falcolas 14y agoNot yet, but if Chrome takes the route of optimizing the asm.js subset of javascript, node.js could gain a lot of traction as a generic high performance asynchronous platform. And that may just be worth getting excited for.
- tracker1 14y agoNodeJS is already gaining traction as a high performance asynchronous platform... Though it's best fit has been in situations that are more IO bound than CPU bound, where it's been a bad fit. This could make it a better fit for CPU tasks, with high IO. Right now, I have a few workers managed in node, that run compiled code. It works pretty well, but having more of that as modules directly available in Node, with nearly the same performance would be really compelling. Not needing to compile certain NodeJS modules is what I'd find really compelling.
- Joeri 14y agoBut if you're cross-compiling from C++ to get asm.js, what would be the advantage? The upside is easier distribution of code, but presumably in the case of node that wouldn't be a big upside.
- tracker1 14y agoConsidering compilation differences between 32/64 bit versions across Linux, Windows and OSX, let alone different versions of NodeJS most native modules require a build system on the platform... As someone who's stuck with windows deployments for NodeJS work, it's been a little painful... I'd take the little performance hit for modules that load/run transparently.
- andreypopp 14y agoI think, that having code in C/C++ is much better than in obscure dialect of JavaScript.
- olalonde 14y agoMost of Node's core is already written in Javascript. Also, I can't see what would be the benefit of using Asm.js vs calling C/C++ libraries directly using FFI.