They write, “Crankshaft uses adaptive compilation to improve both start-up time and peak performance. The idea is to heavily optimize code that is frequently executed and not waste time optimizing code that is not. Because of this, benchmarks that finish in just a few milliseconds, such as SunSpider, will show little improvement with Crankshaft. The more work an application does, the bigger the gains will be.”
As this diagram shows, Google Chrome gets a major boost in speed using Crankshaft as compared to earlier versions:
- A base compiler which is used for all code and generates code quickly without the need for lots of optimizations. This is twice as fast as with the V8 compiler in Chrome 9 while generating 30% less code.
- A runtime profiler that monitors the running system and identifies code that spends a lot of time running.
- An optimizing compiler which recompiles and optimizes code that the runtime profiler has identified as taking a while to run. That code is then optimized.
- Deoptimization support which tell the optimizing compiler to be optimistic in the assumptions it makes when generating code.