Web & communication software

New V8 Tech Gives Chrome an Extra Shot of Speed

Google's Chrome browser already enjoys something of a reputation for speed, and the most recent stable version to debut--Chrome 18--extended that further by improving graphics performance on both new and older hardware.

Now, however, it looks like upcoming versions of the software could be even speedier thanks to new technology in its V8 JavaScript engine.

“As of current dev and beta channel releases, V8 uses a new algorithm based on counters to decide which functions to optimize,” wrote Google software engineer Jakob Kummerow in a blog post on Tuesday. “This greatly increases performance for small JavaScript programs.”

On the SunSpider benchmark, in fact--one that focuses on very short-running tests--V8's speed has improved by about 25 percent, as indicated in the chart below.

Two Alternate Compilers

To execute JavaScript, Google's open source V8 engine begins by compiling to machine code with a quick compiler that doesn't perform any optimization on the code it produces.

SunSpider Scores
Credit: Google
A second, optimizing compiler is available that can generate faster machine code, but it takes much longer and thus must be used selectively, Kummerow explained. Accordingly, V8 is designed to try to predict which functions will benefit most from optimization and use that second, more time-intensive technique only on the most promising candidates.

“In the past, V8 stopped once every millisecond to look at currently running functions, and eventually optimized them,” he noted. “For long-running programs, this worked great, but short-running programs often finished before they could benefit much from the optimizing compiler.”

V8 also sometimes made different optimization decisions each time a JavaScript program ran, with the result that small but performance-critical functions were occasionally overlooked.

Better Optimization

The new version of V8, by contrast, optimizes sooner and more consistently by analyzing the running program in more detail, Kummerow said. Specifically, the new technology uses counters to keep track of how often JavaScript functions are called and loops are executed in a program, thereby approximating the time spent inside each function.

“That way, V8 is able to quickly gather fine-grained information about performance bottlenecks in a JavaScript program, and to make sure that the optimizing compiler's efforts are spent on those functions that deserve it most,” he said.

Bottom line? The current beta version of Chrome 19 and its successors promise the benefit of an extra shot of speed.

Want to try out the latest beta version? It's available as a free download for Windows, Linux, and Mac OS X from the Chrome site.

Subscribe to the Daily Downloads Newsletter