Last active
August 29, 2015 14:02
-
-
Save jbailey4/6708a297260084d2ea0a to your computer and use it in GitHub Desktop.
Track how long (in milliseconds) a Javascript block takes to execute - using Chrome's console
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
// paste this in your Chrome's console to try it out, could be useful | |
// big loop | |
console.time( 'big-loop' ); | |
var arrBig = []; | |
for ( var i = 0; i < 1000; i++ ) | |
arrBig.push( i ); | |
console.timeEnd( 'big-loop' ); | |
// small loop | |
console.time( 'small-loop' ); | |
var arrSmall = []; | |
for ( var j = 0; j < 100; j++ ) | |
arrSmall.push( j ); | |
console.timeEnd( 'small-loop' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment