Created
January 24, 2012 17:41
-
-
Save leobalter/1671424 to your computer and use it in GitHub Desktop.
Bitwise vs Alto Nível
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('prof 1'); | |
var i = 0; | |
var str = ''; | |
while (i < 1000000) { | |
str += (i & 1); | |
i++; | |
} | |
console.log(str); | |
console.timeEnd('prof 1'); | |
console.time('prof 2'); | |
var i = 0; | |
var str = ''; | |
while (i < 1000000) { | |
str += (i % 2); | |
i++; | |
} | |
console.log(str); | |
console.timeEnd('prof 2'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment