What's under the bonnet?
Posted on 14 Nov 2008 at 12:13
Chrome may look Spartan, but beneath the surface lies a powerful new browser engine.
Chrome represents a ground-up attempt to build the perfect platform for web applications. Two technologies in particular give Google's new browser a real head start when it comes to online services: the V8 JavaScript engine and Google Gears.
Tuning the V8
The big new feature in Chrome is the V8 JavaScript engine. Many online applications, such as Google Docs and Gmail, make extensive use of JavaScript, meaning various routines are executed within the client's web browser, rather than on the remote server. Google's developers realised that if it were possible to execute JavaScript more quickly and efficiently, that would give more processing power to web applications while reducing their memory overheads.
The V8 JavaScript engine was designed by a dedicated team based in Denmark to do exactly that. "We started with no code," explained Lars Bak, one of the engineers, "just some wild ideas about how to make it go really fast."
The most fundamental of those "wild ideas" was moving from interpreted to compiled code. Traditionally, JavaScript engines have parsed code on the fly, downloading scripts from a remote website and interpreting them, line-by-line, into machine code as needed. That's a perfectly viable approach, but it's ill-suited to complex applications, which are likely to make heavy use of loops and repeated sections of code - especially in a procedural language such as JavaScript. So Chrome takes a different approach: it's the first browser to compile web scripts into machine code at the outset, and thereafter use the object code exclusively. This may initially take a little more time, but once up and running the improvement gained by switching from interpreted to compiled code can be immense.
Variable outlook
V8 also tries to optimise variable handling, to keep memory usage as low as possible and reduce redundant computations. Objects in JavaScript are conventionally classless, meaning you can apply any sort of property to any object. Existing JavaScript interpreters therefore have to treat each object as a unique case. V8 tries to identify the objects your code is using, enabling it to group them into "hidden classes" and apply "dynamic optimisations" on a class basis.
The final big improvement in V8 comes with garbage collection. All JavaScript engines try to save resources by ditching objects that aren't needed any more. But current interpreters don't actively keep track of their object pointers, meaning they're left - in Google's words - "searching through the execution stack to see which words look like pointers" to find unreferenced objects which can be dropped. This is hardly efficient, and inevitably returns false positives thanks to "integers that just happen to have the same address as an object in the object heap". Result: unused objects hang around and take up memory long after they're needed. V8, by contrast, keeps a record of all its pointers, meaning it can easily identify all orphaned objects - without the need to comb the stack.
Taken together, these upgrades make Chrome by far the fastest browser on the market when it comes to JavaScript. As you'll see from our tests it's more than 20 times faster than Internet Explorer 7 in this respect.
Grinding Google's Gears
The other big new technology in Chrome is Gears. Except that Gears isn't new: it's been available for more than a year as a plug-in for Firefox, Internet Explorer, Safari on the Mac and even IE Mobile on Windows Mobile.
From around the web
For more details about purchasing this feature and/or images for editorial usage, please contact Jasmine Samra on pictures@dennis.co.uk
advertisement
- Mozilla: everyone should learn a little bit of code
- Google mines social network data for semantic search
- Microsoft tweaks multi-monitor support in Windows 8
- Phone sales shrink as consumers await fresh handsets
- Nvidia warns 28nm supply problems continue
- File-fixing tools to improve uptime in Windows 8
- Mozilla: Microsoft blocking rival browsers in Windows RT
- Microsoft developing sound-based gesture control
- Dell working on Ubuntu Ultrabook for developers
- Media Center to be paid-for add-on in Windows 8
- Sony VAIO T Series Ultrabook review: first look
- Revealed: the military standards and robots HP uses to test its laptops
- Windows 8: multi-monitors and double standards?
- Why is TalkTalk's year-old porn filter suddenly big news?
- Why are laptop screens so far behind mobiles?
- HP EliteBook Folio review: first look
- The shoebox-sized all-in-one printer
- Forget the Ultrabook: here comes the HP Sleekbook
- HP Spectre XT review: first look
- Samsung Galaxy S III review: first look
advertisement

