V8 optimization killersEdit
Things which cause the entire containing function to be deoptimized (ie. compiled with the generic compiler instead of the optimizing compiler, which can be 100x slower):
- generator functions
for
/of
statementstry
/catch
statementstry
/finally
statements- compound
let
assignment - compound
const
assignment - object literals with a
__proto__
property, orget
orset
declarations debugger
eval()
with
- any use of
arguments
exceptarguments.length
,arguments[i]
(wherei
is an inbounds integer index) andfoo.apply(bar, arguments)
switch
with more than 128case
clausesfor
/in
if:- "key" is not a strictly local variable
- object is in dictionary mode (ie. because of properties added/deleted outside the constructor)
- object has enumerable properties in its prototype chain
- object has array indices (true for arrays, obviously)