Feeds

Google's revamped JavaScript engine cures Chrome's stutters

Doing two things at once? Hey, great idea

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

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. ®

HP ProLiant Gen8: Integrated lifecycle automation

More from The Register

next story
Whoah! How many Google Play apps want to read your texts?
Google's app permissions far too lax – security firm survey
Chrome browser has been DRAINING PC batteries for YEARS
Google is only now fixing ancient, energy-sapping bug
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
EU dons gloves, pokes Google's deals with Android mobe makers
El Reg cops a squint at investigatory letters
Big Blue Apple: IBM to sell iPads, iPhones to enterprises
iOS/2 gear loaded with apps for big biz ... uh oh BlackBerry
OpenWRT gets native IPv6 slurping in major refresh
Also faster init and a new packages system
prev story

Whitepapers

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.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Application security programs and practises
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.