In association with heise online

02 May 2012, 13:12

Google cranks up the V8 JavaScript engine

  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

V8 logo Google has confirmed that the current development and beta channels for the Chrome browser contain a version of V8 which uses counters to select which functions it should optimise. The change offers great improvement on small JavaScript programs; for example, the SunSpider benchmark, comprised of many short-running tests, runs 25 per cent faster with the new optimiser.

V8 uses a fast compiler to convert JavaScript to machine code as quickly as possible and without any optimisation. It also has an optimising compiler, but as optimising is time and cpu resource consuming, decisions have to be made over which code is optimised. Current and previous versions of V8 would stop every millisecond, look at what functions were running and place them in the queue for optimisation; this was good for programs that took a long time to run, but short-lived programs were hardly touched by the optimiser and, because it was using a snapshot approach to selecting functions, small but performance-critical functions could be missed.

The new approach is to use counters within the code which accurately track how many times functions are called or loops are executed and approximate the time spent inside. With that detailed information, performance bottlenecks are more easily spotted and the optimising compiler can be more accurately targeted at the time-consuming code. The new algorithm is available in the Beta channel for Chrome for Windows, Mac OS X and Linux. The BSD-licensed V8 JavaScript engine is available from the project's Google Code pages.


Print Version | Send by email | Permalink:

  • July's Community Calendar

The H Open

The H Security

The H Developer

The H Internet Toolkit