Last active
December 12, 2017 16:57
-
-
Save jacobwise/931dfe470c4f01422dd5c99cb0574816 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var tests = 1000; | |
var i = 0; | |
var t0 = performance.now(); | |
while (i < tests) { | |
functionOne() | |
i++; | |
} | |
var t1 = performance.now(); | |
console.log("Call to test 1 took " + (t1 - t0) + " milliseconds."); | |
var j = 0; | |
var t0 = performance.now(); | |
while (j < tests) { | |
functionTwo() | |
j++; | |
} | |
var t1 = performance.now(); | |
console.log("Call to test 2 took " + (t1 - t0) + " milliseconds."); | |
function functioOne() { | |
return true | |
} | |
function functionTwo() { | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment