With the browser wars fully engaged – the improvements in JavaScript speed has been no less than astonishing. But now its not just Mozilla versus Microsoft but also Google, Apple Safari, and Opera are in the mix. Just a couple of years ago, IE7 used to lead the parade with the fastest JavaScript performance in a browser. Take a look at where IE7 stands now versus the latest browsers as of March of 2009:
Okay, you will say this is overall browser performance and not JavaScript speed alone. So here are some of the latest JavaScript benchmarks which show the same pattern of dramatically improved JavaScript speed.
However, as noted there is margin for even more dramatic speed improvements. The Begley set of benchmarks seems to add credibility to this notion – here is the JavaScript versus Java comparison[note I am not certain which version of JavaScript Spidermonkey is being used – but it is clearly not the new Tracemonkey version]. The benchmark appears to be from circa 2008, not the latest and greatest available from Mozilla. In any case, JavaScript lags way behind behind Java in performance ranging from 2 times to 183 times slower than Java with an average of 56-times slower than Java on the Begley set of benchmarks. So there is certainly margin for improvement.
And there are obviously parties working on that right now. Mozilla’s Tamarin Project is creating a virtual machine for JavaScript. But this VM targets the upcoming JavaSCript 2/ECMAScript 4 version which is quite different from the current JavaScript 1.x [the next version of JavaScript will have OO required with many new OO features like packages, interfaces, overloading, protect, etc]. Note your version of JavaScript depends on your browser being used – for example, the new Firefox 3.5 uses JavaSCript 1.8. But there are also marked improvements in Safari and Chrome browsers’ JavaScript speed, so development teams there are obviously working on improving the current JavaScript1.x/ECMAScript 3.x standard.
I suspect that when a final VM-strategy comes to JavaScript its speeds will dramatically improve. There is is precedence for this – just look at the Adobe’s AVM2 virtual machine which runs ActionScript 3 code in the latest Flash applications. Already there is clear evidence of 3x improvements in speed delivered by Adobe’s AVM2 for the ActionScript 3. Now also consider that ActionaScript is a nearly complete superset of ECMAScript 4/JavaScript 2 – the upcoming JavaScript standard. Also consider that Adobe has given the AVM2 technology to Mozilla for a)joint development and b)incorporation into Mozilla’s Firefox browser. Mozilla’s Brendan Eich, the creator/maintainer of JavaScript, unveils here some of the first round of improvements in speed for JavaScript Spidermonkey’s successor Tracemonkey delivered through the Tamarin project. Also Google is clearly committed to improving performance on the Web with JavaScript clearly being one key tool. So the race is on to optimize JavaScript – and as more Web 2.0 functionality brings a thicker overlay of JavaScript that can only mean faster Web and Mobile smartphone apps and response times from the software side. With WiMax and then LTE wireless technology speed improvements due this year and next on the hardware side, do expect Web 2.0 and Cloud Computing to be well provided for in speed/performance over the next 2-5 years.