Feeds

Google's revamped JavaScript engine cures Chrome's stutters

Doing two things at once? Hey, great idea

Internet Security Threat Report 2014

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

Beginner's guide to SSL certificates

More from The Register

next story
Download alert: Nearly ALL top 100 Android, iOS paid apps hacked
Attack of the Clones? Yeah, but much, much scarier – report
NSA SOURCE CODE LEAK: Information slurp tools to appear online
Now you can run your own intelligence agency
Microsoft: Your Linux Docker containers are now OURS to command
New tool lets admins wrangle Linux apps from Windows
Microsoft adds video offering to Office 365. Oh NOES, you'll need Adobe Flash
Lovely presentations... but not on your Flash-hating mobe
You stupid BRICK! PCs running Avast AV can't handle Windows fixes
Fix issued, fingers pointed, forums in flames
HTML5 vs native: Harry Coder and the mudblood mobile app princes
Developers just want their ideas to generate money
prev story

Whitepapers

Go beyond APM with real-time IT operations analytics
How IT operations teams can harness the wealth of wire data already flowing through their environment for real-time operational intelligence.
5 critical considerations for enterprise cloud backup
Key considerations when evaluating cloud backup solutions to ensure adequate protection security and availability of enterprise data.
Forging a new future with identity relationship management
Learn about ForgeRock's next generation IRM platform and how it is designed to empower CEOS's and enterprises to engage with consumers.
Reg Reader Research: SaaS based Email and Office Productivity Tools
Read this Reg reader report which provides advice and guidance for SMBs towards the use of SaaS based email and Office productivity tools.
How to simplify SSL certificate management
Simple steps to take control of SSL certificates across the enterprise, and recommendations centralizing certificate management throughout their lifecycle.