Nikkei Electronics Asia -- January 2009
Cover Story -Analysis
Why Is the New Google V8 Engine So Fast? [Part 1]

E-Mail Article
Tweet This
Digg This
Share this with friends on Facebook
Buzz Up!
Jan 13, 2009 18:02 Nikkei Electronics Asia

The new V8 JavaScript engine developed by Google offers very fast operation. We asked the author, who is familiar with internal programming language implementations, to take a look at how V8 has been speeded up, based on the source code released as open source.

Hajime Morita, Development Engineer of Research & Development Section, Community Engine Inc
The V8 JavaScript engine mounted in Chrome, the new Web browser from Google Inc of the US, is drawing considerable attention for its performance. It was developed by Google specifically to allow Chrome to execute Web applications at high speed. 

Chrome utilizes the WebKit development project spearheaded by Apple Inc of the US as a rendering engine*. WebKit is also used in the Safari browser being developed by Apple. WebKit comes with a JavaScript engine called JavaScriptCore as standard equipment, but Chrome replaces this with V8 (Fig 1). 

* Rendering engine: Web browser component that reads and interprets HTML and other code, and displays the corresponding Web page. 

The V8 development team is a group of programming language specialists. Core engineer Lars Bak formerly developed HotSpot, an acceleration technology for the Java virtual machine (VM) developed by Sun Microsystems Inc of the US.

He also developed an experimental Smalltalk* system called Strongtalk at Animorphic Systems Inc of the US (acquired by Sun Microsystems in 1997). V8 makes good use of the knowledge gained in the development of HotSpot, Strongtalk and others.

* Smalltalk: programming language designed for object-oriented programming.

Need for a Fast Engine

The Google development team began work on V8 in 2006, in part because of Google's dissatisfaction with the execution speed of existing JavaScript engines. I think JavaScript engines back then were slow for two reasons: the historical background to their development, and the complexity of the JavaScript language specification. 

JavaScript has been around for at least a decade. In 1995, it appeared in Netscape Navigator 2.0, the Web browser developed by Netscape Communications Inc of the US. There was little demand for performance improvement for a while, however, because it was only utilized for a little animation, interactive operation or similar actions on Web pages.

Web browser display speed was dependent on the speed of the network downloading the imagery and hypertext markup language (HTML), and the speed of the rendering engine interpreting the HTML, cascading style sheets (CSS) and other code. Browser enhancements placed priority on boosting rendering speed, and JavaScript processing speed was not very important. Java, which appeared at the same time, is quite a bit different, as it has been made faster and faster to compete with C++. 

In the last few years, though, JavaScript has suddenly entered widespread use. The reason is that software formerly distributed as desktop applications, including office suites, is becoming available as software running in a browser.

Google itself has released a number of JavaScript Web applications, including its Gmail electronic mail service, the Google Maps map data service, and the Google Docs office suite. 

The apparent speed of these applications is strongly influenced by not only the performance of the server, network, rendering engine and other factors, but also the execution speed of JavaScript itself. Existing JavaScript engines were unable to fulfill the new requirements, however, and sluggish performance was a key concern for Web application developers.

To be continued

Cover Storyˇ§Runaway Evolution of Google Engine - table of contents

NIKKEI ERECTRONICS ASIA

Nikkei Electronics Asia magazine is available each month free of charge to engineers, managers and other qualified readers.