blob: 1fde9fe8539fd5dfe19a3df9e4f9e6ae39fb102a (
plain)
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
|
<html>
<head>
<script>
function fib(n) {
return n < 2 ? 1 : fib(n - 1) + fib(n - 2);
}
function eternal_fib() {
var started = Date.now();
while(true) {
fib(20);
// Make page responsive by making a break every 100 ms.
if (Date.now() - started >= 100) {
setTimeout(eternal_fib, 0);
return;
}
}
}
function load() {
// Let the page do initial rendering, then go.
setTimeout(eternal_fib, 200);
}
</script>
</head>
<body onload="load()">
</body>
</html>
|