From: Kalervo Kujala Date: Tue, 23 Aug 2011 20:21:15 +0000 (+0300) Subject: Make 'make test' factors faster. X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=3fa8bba48e3933c36bf60a43defefcc6fad26571;p=pdf.js.git Make 'make test' factors faster. 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. --- diff --git a/test/driver.js b/test/driver.js index 716046c..cbb226d 100644 --- a/test/driver.js +++ b/test/driver.js @@ -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(); }