[Pkg-javascript-commits] [pdf.js] 25/161: Heuristic to optimize chunking

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 14:16:19 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 1aaeec80208bf73bb57b025ca464a00bda1eeff2
Author: Yury Delendik <ydelendik at mozilla.com>
Date:   Mon Feb 24 10:07:36 2014 -0600

    Heuristic to optimize chunking
---
 src/core/evaluator.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index 54b4a9e..2265321 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -1278,6 +1278,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
 
 var OperatorList = (function OperatorListClosure() {
   var CHUNK_SIZE = 1000;
+  var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5; // close to chunk size
 
     function getTransfers(queue) {
       var transfers = [];
@@ -1326,6 +1327,10 @@ var OperatorList = (function OperatorListClosure() {
         this.argsArray.push(args);
         if (this.fnIndex >= CHUNK_SIZE) {
           this.flush();
+        } else if (this.fnIndex >= CHUNK_SIZE_ABOUT &&
+          (fn === OPS.restore || fn === OPS.endText)) {
+          // heuristic to flush on boundary of restore or endText
+          this.flush();
         }
       } else {
         this.fnArray.push(fn);

-- 
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