In association with heise online

08 December 2010, 12:57

Chrome's new "Crankshaft" optimises JavaScript at runtime

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


Zoom The new Crankshaft compilation infrastructure for the V8 JavaScript engine brings speed improvements.
Source: Google
Optimisation only makes sense if the code in question is used a lot – this seems to be the philosophy followed by the compilers of the latest incarnation of Google's free V8 JavaScript Engine. The new "Crankshaft" compilation infrastructure for V8 uses runtime information to see which parts of the code would benefit the most from optimisation. The developers say that the technique is mainly useful in large JavaScript programs; short scripts, such as those used by the SunSpider benchmark, do not benefit much.

Crankshaft consists of four components: a base compiler, a runtime profiler, an optimising compiler and de-optimisation support. Google says the base compiler is twice as fast as the V8 compiler in the current beta version of Chrome and the code it generates is reportedly up to 30% smaller. At runtime, the profiler monitors the performance of JavaScript programs and identifies parts that are taking a lot of time. The optimising compiler then focuses on those portions and applies optimisation by moving loop invariants around, by filling the CPU register with variables based on a linear-scan algorithmPDF and by replacing function calls with in-line code. Google says the optimiser is a bit too "optimistic," however, and sometimes causes errors in the optimised code, which the de-optimiser then detects and remedies.

At the moment, Crankshaft is only available in a version for 32-bit Intel CPUs as independent code and in a developer's version of Chrome for Windows called "Canary". However, work has already begun on ARM and 64-bit versions.

See also:

(crve)

Print Version | Send by email | Permalink: http://h-online.com/-1149473
 


  • July's Community Calendar





The H Open

The H Security

The H Developer

The H Internet Toolkit