Skip to content

Instantly share code, notes, and snippets.

@geNAZt
Created January 19, 2013 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geNAZt/4575884 to your computer and use it in GitHub Desktop.
Save geNAZt/4575884 to your computer and use it in GitHub Desktop.
var start = (new Date()).getTime();
var testArray = ["j","a","b"];
for( var i = 0; i < 5000000; i++ ) {
if( Array.isArray(testArray) ) {};
}
console.log( (new Date()).getTime() - start + " ms" );
start = (new Date()).getTime();
for( var i = 0; i < 5000000; i++ ) {
if( testArray instanceof Array ) {};
}
console.log( (new Date()).getTime() - start + " ms" );
/*Result
"C:\Program Files (x86)\nodejs\node.exe" test.js
37 ms
14 ms
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment