Overhead of deoptimization checks in the V8 javascript engine

Gabriel Southern, Jose Renau · 2016

Just-in-time compilation for dynamic languages uses type speculation to generate optimized code for frequently executed code sections. However, even the high-performance code requires checks to ensure that assumptions made during code generation are not violated. If the assumptions are violated then the program reverts to executing unoptimized code. This process is called deoptimization, and the checks are called deoptimization checks. We analyzed the frequency of conditional deoptimization checks and the performance impact of the associated conditional branch using the V8 Javascript engine running the Octane benchmarks. Over half of the benchmarks have at least 5 checks per 100 instructions, and 1 benchmark has as many as 19 checks per 100 instructions. The performance impact of the checks varies significantly depending on the microarchitecture of the CPU that is running the code. On average the conditional branch used by the checks accounts for over 6.2% of the benchmark's dynamic instructions. Removing these checks provides only a 2.2% performance improvement when running on a high performance Intel CPU, but a 4.6% performance improvement on an Intel CPU optimized for low power consumption.

Read the paper · More papers on PaperTik