secret
Last active

  • Download Gist
gistfile1.htm
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
<!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>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.