Skip to content

Instantly share code, notes, and snippets.

@Emp3r
Created October 18, 2017 08:31
Show Gist options
  • Save Emp3r/c01d6a696bbdf48b0a04a27e75bc4915 to your computer and use it in GitHub Desktop.
Save Emp3r/c01d6a696bbdf48b0a04a27e75bc4915 to your computer and use it in GitHub Desktop.
Compare the speed of two functions
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