Feeds

Mozilla mimics Google's native code demo in JavaScript

Time for a Jäger shot

The Power of One Brief: Top reasons to choose HP BladeSystem

Velocity Mozilla believes that its JavaScript engine isn't that far from matching the performance of Google's Native Client plug-in, which eschews web standards to run native code inside the browser.

Speaking today at the net-performance obsessed Velocity conference in Santa Clara, California, Mozilla open source evangelist Chris Blizzard showed off a Firefox JavaScript demo meant to mimic a test that Google uses to show off Native Client, and he said that even with today's Firefox, Mozilla comes within 50 per cent of the performance of native code.

In a web video here, Google shows off a Native Client incarnation of a web-based photo editing app that lets you apply filters in realtime. Blizzard and Mozilla have ported the same app to JavaScript, achieving performance of about seven frames a second versus Google's 15 frames a second.

As Blizzard said, the JavaScript photo demo was "pretty snappy."

"We've started to realize we can do things that would normally be done in native code," Blizzard said. "But we can do them in JavaScript." Just yesterday, Mozilla vice president of product Jay Sullivan told us that the open source outfit has no intention of bundling a Native Client-like plug-in with its browser, preferring to advance standard technologies like HTML5 and JavaScript.

As Blizzard pointed out, the next version of Firefox – Firefox 4, due in beta any day now – will include a new extension to the browser's existing JavaScript engine. Dubbed JaegerMonkey, the extension will operate alongside TraceMonkey – an extension that debuted with Firefox 3.5 last year – interpreting JavaScript code unsuited to "tracing."

TraceMonkey speeds performance by detecting code loops and converting them into assembly language. "We find places where code gets executed more than once," Blizzard said. "We basically optimize that code and trace it to native code."

But there are cases where this sort of thing just doesn't work. This happens with, say, recursion or heavily nested code. As it stands, when tracing fails, Firefox falls back on an interpreter that runs JavsScript at circa 2007 speeds.

With JaegerMonkey, Mozilla adds a Just-in-Time (JIT) engine much like those used by the other major browsers. The extension is actually based on the Nitro JIT used by Apple Safari. Firefox will still do tracing – something other browsers don't do – but it will be able to fall back on the baseline JIT, converting entire methods into assembly language.

"The important thing to realize is that we know we have a lot of things we can to do to optimize for really intensive web apps that will get us within [striking distance] of native code speed," Blizzard said. ®

Securing Web Applications Made Simple and Scalable

More from The Register

next story
HIDDEN packet sniffer spy tech in MILLIONS of iPhones, iPads – expert
Don't panic though – Apple's backdoor is not wide open to all, guru tells us
Apple fanbois SCREAM as update BRICKS their Macbook Airs
Ragegasm spills over as firmware upgrade kills machines
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
Captain Kirk sets phaser to SLAUGHTER after trying new Facebook app
William Shatner less-than-impressed by Zuck's celebrity-only app
Do YOU work at Microsoft? Um. Are you SURE about that?
Nokia and marketing types first to get the bullet, says report
Microsoft takes on Chromebook with low-cost Windows laptops
Redmond's chief salesman: We're taking 'hard' decisions
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
prev story

Whitepapers

Designing a Defense for Mobile Applications
Learn about the various considerations for defending mobile applications - from the application architecture itself to the myriad testing technologies.
How modern custom applications can spur business growth
Learn how to create, deploy and manage custom applications without consuming or expanding the need for scarce, expensive IT resources.
Reducing security risks from open source software
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
Consolidation: the foundation for IT and business transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.