Firefox OdinMonkey and Native Assembly JavaScript, High-speed Java Monkey Business in the Battle of the Browsers…

The Browser Wars reignite this week with the announcement of OdinMonkey for Firefox, a new plug-in that brings high speed native assembly code to JavaScript.

JavaScript, the language behind the internet is going native. In the world of programming there is nothing faster native assembly language, the language that the chips themselves speak. Now Java is leaning to speak assembly thanks to Firefox.

Due for release in June as part of Firefox 22 OdinMonkey and asm.js optimized code may just accelerate Java to near native assembly speeds, while maintaining compatibility and portability, the holy trinity of code.

highpants-firefox-odinmonkey-native-assembly-banner

OdinMonkey and asm.js (Assembly JavaScript) are Firefox’s latest weapons in the browser wars.  With OdinMonkey converting asm.js optimized JavaScript into native assembly code web applications can finally compete with installed applications performance wise at least.

highpants-firefox-odinmonkey-native-assembly-foxyFirefox’s asm.js is a clever new standard that allows programmers to code in a new Java subset which is compiled into native assembly code by OdinMonkey. Mozilla will have a version of OdinMonkey ready for every major platform providing optimizations for each platform.

Code optimized for asm.js is still fully backwards compatible with current Java engines providing the best of both worlds, compatibility now and high speed execution once Odin is released. Sites can be rebuilt now using asm.js with full compatibility even with other non monkey compatible browsers, and once browser technology catches up the sites will accelerate. Development and improvements to OdinMonkey in the future should also provide performance improvements without the need to rebuild your code.

OdinMonkey itself is simply a new module that optimizes Firefox’s JavaScript engine, IonMonkey.  Once Odin converts asm.js to assembly language the native code produced executes at around half the speed of native assembly. This is an exceptional achievement when compared to ordinary JavaScript which executes 20 to 30 times slower than assembly.  Chrome can execute at around ten times the speed of native assembly.

Firefox aren’t the only ones trying to improve Java’s speed with native assembly. OdinMonkey will be competing directly with Google’s Native Client, setting up a battle to become the technology of tomorrow’s internet.

Google’s Native Client works in a similar way by allowing programmers to embed C/C++ code within JavaScript. This C operates at near native speeds but looses the machine independence of Java, the nature of C++ code.

No matter which standard wins in the long run native assembly is the next major enhancement to Java. While the performance improvements for day to day browsing can’t be underestimated the effect on web application will be immense.  The fact that installed applications on our PC’s are written in native assembly has always given them a huge performance advantage. Web applications written in asm.js now have the potential of being almost as fast as these native applications.

Web based games could also enjoy the same performance enhancements. The promise of complete cross platform compatibility could now also become a reality for developers.

As with all new software technologies the largest hurdle of all is standardization. Can asm.js become the new standard for high speed JavaScript? Will we soon be playing all of our games through browsers, living free of installation hassles, key codes and DRM nightmares?

Reference: asm.js blog
Reference: ExtremeTech
Reference: Softpedia

Author: Buddhas Brother