Skip to content

Instantly share code, notes, and snippets.

@jbailey4
Last active August 29, 2015 14:02
Show Gist options
  • Save jbailey4/6708a297260084d2ea0a to your computer and use it in GitHub Desktop.
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
// 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