30 lines
495 B
HTML
30 lines
495 B
HTML
<html>
|
|
<head>
|
|
<script src="foo2.js">
|
|
</script>
|
|
<script>
|
|
invoke(function() {});
|
|
var f = MACHINE.env.globalBindings.factorial.adaptToJs();
|
|
|
|
var startTime;
|
|
|
|
var N = 1000000;
|
|
|
|
startTime = new Date();
|
|
f([N], function(v) { console.log("switch", v, new Date() - startTime); });
|
|
|
|
|
|
var mul = function(x, y) { return x * y; }
|
|
startTime = new Date();
|
|
var acc = 1;
|
|
for (var i = 1; i <= N; i++) {
|
|
acc = mul(acc, i);
|
|
}
|
|
console.log("loops", acc, new Date() - startTime);
|
|
|
|
|
|
</script>
|
|
<body>
|
|
</body>
|
|
</html>
|