Created
June 29, 2017 09:28
-
-
Save zerobias/1e910d8f51674bcc67473613c1886da6 to your computer and use it in GitHub Desktop.
Tail call optinisation detection and call stack depth counter
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
let TCO_ENABLED | |
let stackDepth = 0 | |
try { | |
(function foo(x){ | |
stackDepth+=1 | |
if (x < 5E5) return foo( x + 1 ) | |
})( 1 ) | |
TCO_ENABLED = true | |
} | |
catch (err) { | |
TCO_ENABLED = false | |
} | |
console.log('TCO', TCO_ENABLED, stackDepth) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment