[Pkg-javascript-commits] [pdf.js] 36/246: Right-size |chars.length| and |type.length| in bidi().

David Prévot taffit at moszumanska.debian.org
Sun Sep 7 15:36:23 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit f1d5ec407e6419d29f757898782117f18c0fd851
Author: Nicholas Nethercote <nnethercote at mozilla.com>
Date:   Mon Jul 28 16:35:45 2014 -0700

    Right-size |chars.length| and |type.length| in bidi().
    
    This lets the JS engine resize the array elements buffer immediately,
    thus avoiding some intermediate resizings. This can save multiple MiBs
    of reallocation in text-heavy files.
---
 src/core/bidi.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/core/bidi.js b/src/core/bidi.js
index 16219ce..a89e713 100644
--- a/src/core/bidi.js
+++ b/src/core/bidi.js
@@ -119,8 +119,8 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
     }
 
     // Get types and fill arrays
-    chars.length = 0;
-    types.length = 0;
+    chars.length = strLength;
+    types.length = strLength;
     var numBidi = 0;
 
     var i, ii;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list