Last active
December 23, 2015 00:19
-
-
Save omniosi/6552598 to your computer and use it in GitHub Desktop.
You can use the console.time() and console.timeEnd() methods to measure how long a function or operation in your code takes to complete. You call console.time() at the point in your code where you want to start the timer and console.timeEnd() to stop the timer. The elapsed time between these two calls is displayed in the console. see: https://de…
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
console.time("Array initialize"); | |
// code to measure | |
var array= new Array(1000000); | |
for (var i = array.length - 1; i >= 0; i--) { | |
array[i] = new Object(); | |
}; | |
console.timeEnd("Array initialize"); | |
// console results = Array initialize: 461.127ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment