Feeds

Google's revamped JavaScript engine cures Chrome's stutters

Doing two things at once? Hey, great idea

High performance access to file storage

Google has begun testing a new version of its V8 JavaScript engine for the Chrome browser that improves application performance by executing and compiling JavaScript code at the same time.

"Concurrent code compilation is another step towards reducing latency in Chrome and is part of various ongoing efforts to deliver more responsive, smoother web applications," Google engineer Yang Guo said in a blog post describing the change.

JavaScript is often thought of as an interpreted language because developers deploy their applications in source code form, rather than as compiled binaries. But modern JavaScript engines actually compile JavaScript to machine code on the fly before executing it.

That compilation step can eat up some processor cycles, though, so to minimize delays, V8 doesn't get too fancy about it – at least, not at first. The code is initially compiled in a very straightforward way, without spending much time on performance optimization.

But V8's compilation infrastructure – dubbed "Crankshaft" – is clever. Code that is executed often is actually compiled a second time after the application is already up and running, this time piling on the optimizations to ensure maximum performance.

This optimization phase can be processor-intensive, however, and earlier versions of V8 would run it on the same processing thread that was executing the running application. That meant that if Crankshaft started optimizing a large chunk of code, JavaScript execution could stutter and even appear to pause.

Graph showing how the new Chrome Beta speeds up JavaScript execution

Gaps in the black bar indicate times when JavaScript execution paused.
With earlier versions of Chrome, the circled portion would have been all pause (click to enlarge)

The new Chrome Beta changes that. Compilation now takes place in a separate thread that runs concurrently with the application thread, allowing the precompiled JavaScript to keep chugging while Crankshaft works on optimizing the key bits.

This doesn't just apply to the desktop browser, either. Ever mobile-minded, Google has baked the same changes into the Chrome Beta browser for Android. The result, Guo said, was a speedup of as much as 27 per cent on some JavaScript benchmarks running on a Nexus 5 handset.

The catch, for now at least, is that the revamped V8 is only available in the Chrome Beta channel. Google doesn't announce hard dates for when it plans to promote Chrome builds from Beta to Stable status, but if all goes well in its testing, we can assume that concurrent compilation will be enabled for all Chrome users within the next few months. ®

High performance access to file storage

More from The Register

next story
Windows 8.1, which you probably haven't upgraded to yet, ALREADY OBSOLETE
Pre-Update versions of new Windows version will no longer support patches
Android engineer: We DIDN'T copy Apple OR follow Samsung's orders
Veep testifies for Samsung during Apple patent trial
OpenSSL Heartbleed: Bloody nose for open-source bleeding hearts
Bloke behind the cockup says not enough people are helping crucial crypto project
Half of Twitter's 'active users' are SILENT STALKERS
Nearly 50% have NEVER tweeted a word
Windows XP still has 27 per cent market share on its deathbed
Windows 7 making some gains on XP Death Day
Internet-of-stuff startup dumps NoSQL for ... SQL?
NoSQL taste great at first but lacks proper nutrients, says startup cloud whiz
Microsoft lobs pre-release Windows Phone 8.1 at devs who dare
App makers can load it before anyone else, but if they do they're stuck with it
US taxman blows Win XP deadline, must now spend millions on custom support
Gov't IT likened to 'a Model T with a lot of things on top of it'
prev story

Whitepapers

Mainstay ROI - Does application security pay?
In this whitepaper learn how you and your enterprise might benefit from better software security.
Five 3D headsets to be won!
We were so impressed by the Durovis Dive headset we’ve asked the company to give some away to Reg readers.
3 Big data security analytics techniques
Applying these Big Data security analytics techniques can help you make your business safer by detecting attacks early, before significant damage is done.
The benefits of software based PBX
Why you should break free from your proprietary PBX and how to leverage your existing server hardware.
Mobile application security study
Download this report to see the alarming realities regarding the sheer number of applications vulnerable to attack, as well as the most common and easily addressable vulnerability errors.