From 3fa8bba48e3933c36bf60a43defefcc6fad26571 Mon Sep 17 00:00:00 2001 From: Kalervo Kujala Date: Tue, 23 Aug 2011 23:21:15 +0300 Subject: [PATCH 1/3] 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. --- test/driver.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/driver.js b/test/driver.js index 716046c4b..cbb226dda 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(); } From e00ae164f0f298929ef2e1f0271671dfef4c4400 Mon Sep 17 00:00:00 2001 From: Kalervo Kujala Date: Wed, 24 Aug 2011 19:11:38 +0300 Subject: [PATCH 2/3] Catch multiline log function calls. --- test/driver.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/driver.js b/test/driver.js index cbb226dda..9fa1cfa8c 100644 --- a/test/driver.js +++ b/test/driver.js @@ -221,8 +221,8 @@ function checkScrolling() { } function log(str) { - stdout.insertAdjacentHTML("BeforeEnd", str); + stdout.insertAdjacentHTML('BeforeEnd', str); - if (str.charAt(str.length - 1) == '\n') + if (str.lastIndexOf('\n') >= 0) checkScrolling(); } From b170f8a2f2d3801361a5bbae6f05f53b852c7c9b Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Wed, 24 Aug 2011 19:08:23 -0500 Subject: [PATCH 3/3] Fix shavian.pdf regression and related optimization --- pdf.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pdf.js b/pdf.js index 41445533c..d470ef067 100644 --- a/pdf.js +++ b/pdf.js @@ -208,6 +208,11 @@ var DecodeStream = (function() { this.readBlock(); var end = this.bufferLength; + + // checking if bufferLength is still 0 then + // the buffer has to be initialized + if (!end) + this.buffer = new Uint8Array(0); } this.pos = end; @@ -3340,11 +3345,11 @@ var Page = (function() { var xref = this.xref; var content = xref.fetchIfRef(this.content); var resources = xref.fetchIfRef(this.resources); - if (IsArray(this.content)) { + if (IsArray(content)) { // fetching items var i, n = content.length; for (i = 0; i < n; ++i) - content[i] = xref.fetchIfRef(this.content[i]); + content[i] = xref.fetchIfRef(content[i]); content = new StreamsSequenceStream(content); } this.code = gfx.compile(content, xref, resources, fonts, images);