Skip to content

Instantly share code, notes, and snippets.

@vhf
Created Nov 2, 2015
Embed
What would you like to do?
function printStatus(fn) {
var name = fn.name;
switch(%GetOptimizationStatus(fn)) {
case 1: console.log(name, ' is optimized'); break;
case 2: console.log(name, ' is not optimized'); break;
case 3: console.log(name, ' is always optimized'); break;
case 4: console.log(name, ' is never optimized'); break;
case 6: console.log(name, ' is maybe deoptimized'); break;
}
}
factorial1(100);
factorial1(100);
%OptimizeFunctionOnNextCall(factorial1);
factorial1(100);
printStatus(factorial1);
facRec2(100, 1); // I should add that facRec2(100) leads to the same perf issue
facRec2(100, 1);
%OptimizeFunctionOnNextCall(facRec2);
facRec2(100, 1);
printStatus(facRec2);
facRec3(100, 1);
facRec3(100, 1);
%OptimizeFunctionOnNextCall(facRec3);
facRec3(100, 1);
printStatus(facRec3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment