Skip to content

@kangax /gist:c36ea485926806020024 secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
(function(){
var o1 = {
o2: {
o3: {
o41: 1,
o42: false
}
}
};
function testWith() {
with (o1.o2.o3) {
o41;
o42;
}
}
function testFullPropAccess() {
o1.o2.o3.o41
o1.o2.o3.o42;
}
function testAliasedPropAccess() {
var o = o1.o2.o3;
o.o41;
o.o42;
}
var lim = 500000;
var t = new Date();
for (var i=lim; i--; ) {
testWith();
}
var t1 = new Date() - t;
t = new Date();
for (var i=lim; i--; ) {
testFullPropAccess();
}
var t2 = new Date() - t;
t = new Date();
for (var i=lim; i--; ) {
testAliasedPropAccess();
}
var t3 = new Date() - t;
document.write('t1: ' + t1 + 'ms<br>t2: ' + t2 + 'ms<br>t3: ' + t3 + 'ms');
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.