Created
November 26, 2013 02:03
-
-
Save robotlolita/7652390 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 f(a) { | |
if (a > 1000) return 1 | |
if (a > 100) return 2 | |
if (a > 10) return 3 | |
return 4 | |
} | |
var i = 100000; | |
while (i--) { | |
f(Math.random() * 1000) | |
} | |
// $ node --trace-inlining bar-2.js | |
// Inlining builtin 0x148b0391c829 <JS Function random> | |
// Inlined f called from . |
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 f(a) { | |
if (a > 1000) return 1 | |
if (a > 100) return 2 | |
if (a > 10) return 3 | |
return f | |
} | |
var i = 100000; | |
while (i--) { | |
f(Math.random() * 1000) | |
} | |
// $ node --trace-inlining bar.js | |
// Inlining builtin 0x31104761c829 <JS Function random> | |
// Did not inline f called from (target requires context change). | |
(It apparently does inline if the inconsistent types are primitives/nullables, though) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment