Guest User

Untitled

a guest
Dec 14th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. var tests = 1000;
  2. var i = 0;
  3. var t0 = performance.now();
  4. while (i < tests) {
  5. functionOne()
  6. i++;
  7. }
  8.  
  9. var t1 = performance.now();
  10. console.log("Call to test 1 took " + (t1 - t0) + " milliseconds.");
  11.  
  12. var j = 0;
  13. var t0 = performance.now();
  14.  
  15. while (j < tests) {
  16. functionTwo()
  17. j++;
  18. }
  19. var t1 = performance.now();
  20. console.log("Call to test 2 took " + (t1 - t0) + " milliseconds.");
  21.  
  22. function functioOne() {
  23. return true
  24. }
  25.  
  26. function functionTwo() {
  27. return false
  28. }
Add Comment
Please, Sign In to add comment