Feeds

Google's revamped JavaScript engine cures Chrome's stutters

Doing two things at once? Hey, great idea

The Power of One Brief: 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. ®

Seven Steps to Software Security

More from The Register

next story
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
KDE releases ice-cream coloured Plasma 5 just in time for summer
Melty but refreshing - popular rival to Mint's Cinnamon's still a work in progress
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
Another day, another Firefox: Version 31 is upon us ALREADY
Web devs, Mozilla really wants you to like this one
Google shows off new Chrome OS look
Athena springs full-grown from Chromium project's head
prev story

Whitepapers

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.
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.
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.
Securing Web Applications Made Simple and Scalable
Learn how automated security testing can provide a simple and scalable way to protect your web applications.