Created
October 18, 2017 08:31
-
-
Save Emp3r/c01d6a696bbdf48b0a04a27e75bc4915 to your computer and use it in GitHub Desktop.
Compare the speed of two functions
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
var iterations = 1000000; | |
console.time('Function 1'); | |
for (let i = 0; i < iterations; i++ ){ | |
functionOne(); | |
}; | |
console.timeEnd('Function 1') | |
console.time('Function 2'); | |
for (let i = 0; i < iterations; i++ ){ | |
functionTwo(); | |
}; | |
console.timeEnd('Function 2') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment