-
-
Save vhf/01c095e09accf72108a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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