]> git.parisson.com Git - pdf.js.git/commitdiff
Make 'make test' factors faster.
authorKalervo Kujala <kkujala@>
Tue, 23 Aug 2011 20:21:15 +0000 (23:21 +0300)
committerKalervo Kujala <kkujala@>
Tue, 23 Aug 2011 20:21:15 +0000 (23:21 +0300)
Profiling with firebug reveals that log and checkScrolling functions slow down
the 'make test' by factors.

Use insertAdjacentHtml in the log fucntion insteand of appending to
innerHTML. Also call checkScrolling function only when it is prudent to do
instead of unnecessarily in every log function call.

test/driver.js

index 716046c4ba786b6f9f679e5ee780b020dfd903fd..cbb226ddabd18f808bbf68eb5562283d0e84b35c 100644 (file)
@@ -221,6 +221,8 @@ function checkScrolling() {
 }
 
 function log(str) {
-  stdout.innerHTML += str;
-  checkScrolling();
+  stdout.insertAdjacentHTML("BeforeEnd", str);
+
+  if (str.charAt(str.length - 1) == '\n')
+    checkScrolling();
 }