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/ofstatementstry/catchstatementstry/finallystatements- compound
letassignment - compound
constassignment - object literals with a
__proto__property, orgetorsetdeclarations debuggereval()with- any use of
argumentsexceptarguments.length,arguments[i](whereiis an inbounds integer index) andfoo.apply(bar, arguments) switchwith more than 128caseclausesfor/inif:- "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)