speculative optimization

Compiling code on the bet that values will keep the types seen so far, with checks that fall back to slower code if the bet fails.

In more detail

Because JavaScript is dynamically typed, a compiler cannot know types in advance. V8 gathers type feedback while interpreting, and TurboFan uses it to produce fast code for the common case.

Related terms

Taught in

References