Feeds

Google's revamped JavaScript engine cures Chrome's stutters

Doing two things at once? Hey, great idea

Securing Web Applications Made Simple and Scalable

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

Bridging the IT gap between rising business demands and ageing tools

More from The Register

next story
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
Put down that Oracle database patch: It could cost $23,000 per CPU
On-by-default INMEMORY tech a boon for developers ... as long as they can afford it
Google shows off new Chrome OS look
Athena springs full-grown from Chromium project's head
Apple: We'll unleash OS X Yosemite beta on the MASSES on 24 July
Starting today, regular fanbois will be guinea pigs, it tells Reg
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
DARPA-derived secure microkernel goes open source tomorrow
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
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.
Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Top 8 considerations to enable and simplify mobility
In this whitepaper learn how to successfully add mobile capabilities simply and cost effectively.
Seven Steps to Software Security
Seven practical steps you can begin to take today to secure your applications and prevent the damages a successful cyber-attack can cause.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.