Wednesday 7 May 2014

Apple has its own JavaScript accelerator in the works...




Mention JavaScript engines at this point, and the big name that comes to mind is Google's V8, the engine that powers not only Google Chrome but Node.js as well. Firefox's SpiderMonkey also gets mention for its implementation of asm.js that can make JavaScript run nearly as fast as native code.

Apple, too, has a JavaScript engine --JavaScriptCore (aka "Nitro") for WebKit -- and its most recent set of changes give it a performance boost to rival its industry comrades.
These upgrades, codenamed "FTLJIT," use the LLVM compiler as the JIT (just-in-time) compilation system. LLVM is a compiler technology nominally used for C/C++ compilation, but it's not tied exclusively to that language, and so compilers for most any language can be developed with it. LLVM was used by the latest incarnation of Emscripten to boost performance of the asm.js subset of JavaScript, developed by Mozilla to run at speeds near that of native C code.
FTLJIT is still considered experimental, so although it's being made available in the OS X port of WebKit by default, it's not actually turned on yet -- it has to be enabled through command-line flags.
One attribute that could make FTLJIT stand out from the pack all the more is how well it runs JavaScript code that is not specifically optimized for asm.js. Every JavaScript engine will run asm.js code, but only Mozilla's SpiderMonkey honors asm.js-specific optimizations, and right now no other browser maker has elected to follow Mozilla's lead.
So far, the speed boosts afforded by FTLJIT vary but are intriguing. AreWeFastYet, the JavaScript testing site founded by Mozilla's JavaScript team, ran its own benchmarks on 64-bit OS X and found the LLVM-powered build of WebKit to be markedly faster than Chrome on some benchmarks. That said, Firefox running asm.js versions of the same benchmarks still consistently beat WebKit. Also, the FTLJIT version of WebKit currently only has prebuilt binaries available for OS X, which makes it harder to tell how much cross-platform progress Apple has made against the other engines.
Google Chrome's Blink browser engine was itself a derivative of WebKit, although Google's V8 engine was an in-house creation. It's distantly possible Google could also try adapting an LLVM-powered approach to V8 (à la the experiments attempted by JXcore), but all the signs so far show Google committed solidly to V8.




courtesy: www.infoworld.com

No comments:

Post a Comment

Twitter Bird Gadget