changeset 16:a8a89f74338b

Incremental rendering with interval timer
author Chris Cannam
date Mon, 05 Oct 2015 15:06:39 +0100
parents ece8682d8293
children 9619d2da67c2
files fft/test.js
diffstat 1 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/fft/test.js	Mon Oct 05 14:54:12 2015 +0100
+++ b/fft/test.js	Mon Oct 05 15:06:39 2015 +0100
@@ -192,17 +192,23 @@
     fft.discard();
 }
 
+var tests = [ testNayuki, testNockert, testDntj, testCross, testKissFFT ];
+var nextTest = 0;
+var interval;
+
 function test() {
+    clearInterval(interval);
+    if (nextTest < tests.length) {
+	f = tests[nextTest];
+	nextTest++;
+	f();
+	interval = setInterval(test, 100);
+    }
+}
 
+window.onload = function() {
     document.getElementById("test-description").innerHTML =
 	"Running " + 2*iterations + " iterations per implementation, of FFT size " + size + ".<br>Timings are given separately for the first half of the run (" + iterations + " iterations) and the second half, in case the JS engine takes some warming up."
-
-    testNayuki();
-    testNockert();
-    testDntj();
-    testCross();
-    testKissFFT();
+    interval = setInterval(test(), 100);
 }
 
-window.onload = test;
-