Heuristic to optimize chunking

This commit is contained in:
Yury Delendik 2014-02-24 10:07:36 -06:00
parent 257898b359
commit 1aaeec8020

View File

@ -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);