mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
53 lines
1 KiB
HTML
53 lines
1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
|
<title>Quickie CoffeeScript Speed Tests</title>
|
|
<script type="text/javascript" src="http://www.broofa.com/Tools/JSLitmus/JSLitmus.js"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<h1>Quickie CoffeeScript Speed Tests</h1>
|
|
|
|
<script type="text/javascript">
|
|
var num = 1000;
|
|
var arr = [];
|
|
while (num--) arr.push(num);
|
|
|
|
var f1 = function f1() {
|
|
return arr;
|
|
};
|
|
|
|
JSLitmus.test('regular function', function() {
|
|
f1();
|
|
});
|
|
|
|
var __this = this;
|
|
|
|
var f2 = function f2() {
|
|
return (function() {
|
|
return arr;
|
|
}).apply(__this, arguments);
|
|
};
|
|
|
|
JSLitmus.test('bound function', function() {
|
|
f2();
|
|
});
|
|
|
|
var f3 = (function() {
|
|
__b = function() {
|
|
return arr;
|
|
};
|
|
return (function f2() {
|
|
return __b.apply(__this, arguments);
|
|
});
|
|
})();
|
|
|
|
JSLitmus.test('prebound function', function() {
|
|
f3();
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|