Skip to content

Instantly share code, notes, and snippets.

@papandreou
Forked from mikeal/gist:791526
Created January 22, 2011 21:53
Show Gist options
  • Save papandreou/791527 to your computer and use it in GitHub Desktop.
Save papandreou/791527 to your computer and use it in GitHub Desktop.
var one = {}
, two = {'o':true}
;
function ifTest () {
var start = new Date();
var i = 0;
while (i<10000) {
if (one.o) true
if (two.o) true
i++;
}
var end = new Date();
console.log('ifTest: '+(end - start))
}
function inTest () {
var start = new Date();
var i = 0;
while (i<10000) {
if ('o' in one) true
if ('o' in two) true
i++
}
var end = new Date();
console.log('inTest: '+(end - start))
}
ifTest();
inTest();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment