Maybe you remember the NaCl or PNaCl plug-in from Google, that allows to safely run code at near native speed on the browser (only 10-30% speed loss, in a probably safe sandbox). This plug-in seems interesting, but so far I think it's not getting a lot of traction, and it seems Mozilla is not interested in it.

Now on Reddit they have linked "asm.js". It's an easy to compile subset of JavaScript, that contains type annotations (inside comments, so it's still valid standard JavaScript). Mozilla has created a modified version of its JIT that recognizes asm.js code and compiles it ahead of time to give, they say, about half the speed of native code (if it's not recognized, it's seen as normal JS). Even if this speed will increase a little with time, I think it will keep being a little slower than NaCl code, but maybe for lot of people the speed of asm.js will be enough (and the safety of NaCl is not so certain).

A modified version of Emscripten (a LLVM bytecode to JavaScript compiler) outputs asm.js. So if you have C/C++ code, with Emscripten and some parts of LLVM you compile it to asm.js, and then Firefox Nightly recognizes it (there is an annotation).

So given the LDC2 project, maybe with LDC+Emscripten+asm.js there is a chance to see D on the web. I think someone will be happy to use D instead of C/C++ on the web for performance-sensitive code, like games. This is a small window of opportunity for D.

Bye,
bearophile

Reply via email to