Last active
December 16, 2015 05:09
-
-
Save mahnunchik/5382101 to your computer and use it in GitHub Desktop.
node test.js without toUpperCase: 1ms
with toUpperCase: 9ms
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('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