Skip to content

Instantly share code, notes, and snippets.

@leobalter
Created January 24, 2012 17:41
Show Gist options
  • Save leobalter/1671424 to your computer and use it in GitHub Desktop.
Save leobalter/1671424 to your computer and use it in GitHub Desktop.
Bitwise vs Alto Nível
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