Skip to content

Instantly share code, notes, and snippets.

@mahnunchik
Last active December 16, 2015 05:09
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 mahnunchik/5382101 to your computer and use it in GitHub Desktop.
Save mahnunchik/5382101 to your computer and use it in GitHub Desktop.
node test.js without toUpperCase: 1ms with toUpperCase: 9ms
console.time('without toUpperCase');
for(var i=0; i < 100000; i++){
var str = "sOmeStR";
if(str == "sOmeStR"){
//console.log('==');
}
}
console.timeEnd('without toUpperCase');
console.time('with toUpperCase');
for(var i=0; i < 100000; i++){
var str = "sOmeStR";
if(str.toUpperCase() == "SOMESTR"){
//console.log('==');
}
}
console.timeEnd('with toUpperCase');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment