Today we present to you Crankshaft, a new compilation infrastructure for V8, JavaScript engine Google Chrome. Using aggressive optimization, Crankshaft significantly improves the performance of demanding JavaScript applications — often more than double! This makes web pages and applications using complex code more responsive and fast for users. Let's compare Chrome's performance with and without Crankshaft on the
standard V8 test suite :

')
Most of all, Crankshaft improves the results of Richards, DeltaBlue and Crypto tests. This shows that we have accelerated access operations to the properties of objects, arithmetic operations, heavy loops, and function calls. Overall, Crankshaft improves V8 performance by 50% on this test suite. This is the biggest breakthrough since the release of Chrome in 2008:

In addition to increasing peak performance measured on tests, Crankshaft accelerated the initialization time of web applications such as GMail. Our
page reload test showed that Crankshaft speeds up page load times with a significant amount of JavaScript code by 12%.
Crankshaft uses adaptive compilation to improve both launch time and maximum performance. The idea is to significantly optimize often executing code and not to waste time on optimizing code that runs infrequently. Because of this, tests that run in a few milliseconds (for example, SunSpider) will show only a slight acceleration when using Crankshaft. The larger the application, the greater will be the effect of the new engine.
Crankshaft consists of four main components:
- The base compiler is used for all code. It works quickly and does not make complex optimizations. Basic is twice as fast as V8 in Chrome 9 and creates 30% less code.
- A profiler that monitors the execution process and finds the “hot” parts of the code for which the most time is spent executing.
- An optimizing compiler that re-compiles the identified “hot” parts of the code. It uses the SSA representation for optimizations such as moving or carrying out loop invariants , linear scan [1], and embedding . The optimizing compiler in its work uses the information collected during the execution of the original version of the code.
- Support for de-optimization , due to which the optimizing compiler can be free in its assessments regarding the usefulness of individual optimizations. If the assumptions used by the compiler for choosing one or another optimization turn out to be incorrect, then there is an opportunity to return to the execution of the code obtained by the basic compiler.
V8 with Crankshaft for Intel processors with 32-bit architecture are already available in the
bleeding edge V8 repository and
test versions of Google Chrome. Work on assemblies for ARM and 64-bit architectures is already underway.
We are pleased with the speed of javascript execution we achieved with Crankshaft. Crankshaft provides an excellent infrastructure to further accelerate the V8, and we will continue to strive to increase JavaScript performance for the next generation of web applications.
Kevin Millikin, Software Engineer and Florian Schneider, Software Engineer[1] Thanks to mraleph for clarifying the translation .