Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- }
Add Comment
Please, Sign In to add comment