[WIP] Tweak Pako to reduce object creation
This commit tweaks pako slightly to reduce the number of objects it creates unecessarily.
This commit is contained in:
parent
8eedab379f
commit
a842140b51
|
|
@ -3,3 +3,4 @@ Rebuilding inflator.js
|
||||||
- Download pako from npm
|
- Download pako from npm
|
||||||
- Install browserify using npm
|
- Install browserify using npm
|
||||||
- browserify utils/inflator.partial.js -o include/inflator.js -s inflator
|
- browserify utils/inflator.partial.js -o include/inflator.js -s inflator
|
||||||
|
- apply changes from utils/inflator.diff.js to include/inflator.js
|
||||||
|
|
|
||||||
|
|
@ -889,7 +889,7 @@ function inflate(strm, flush) {
|
||||||
var len; /* length to copy for repeats, bits to drop */
|
var len; /* length to copy for repeats, bits to drop */
|
||||||
var ret; /* return code */
|
var ret; /* return code */
|
||||||
var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */
|
var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */
|
||||||
var opts;
|
var opts = {};
|
||||||
|
|
||||||
var n; // temporary var for NEED_BITS
|
var n; // temporary var for NEED_BITS
|
||||||
|
|
||||||
|
|
@ -1425,7 +1425,7 @@ function inflate(strm, flush) {
|
||||||
state.lencode = state.lendyn;
|
state.lencode = state.lendyn;
|
||||||
state.lenbits = 7;
|
state.lenbits = 7;
|
||||||
|
|
||||||
opts = {bits: state.lenbits};
|
opts.bits = state.lenbits;
|
||||||
ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
|
ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
|
||||||
state.lenbits = opts.bits;
|
state.lenbits = opts.bits;
|
||||||
|
|
||||||
|
|
@ -1556,7 +1556,7 @@ function inflate(strm, flush) {
|
||||||
concerning the ENOUGH constants, which depend on those values */
|
concerning the ENOUGH constants, which depend on those values */
|
||||||
state.lenbits = 9;
|
state.lenbits = 9;
|
||||||
|
|
||||||
opts = {bits: state.lenbits};
|
opts.bits = state.lenbits;
|
||||||
ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
|
ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
|
||||||
// We have separate tables & no pointers. 2 commented lines below not needed.
|
// We have separate tables & no pointers. 2 commented lines below not needed.
|
||||||
// state.next_index = opts.table_index;
|
// state.next_index = opts.table_index;
|
||||||
|
|
@ -1573,7 +1573,7 @@ function inflate(strm, flush) {
|
||||||
//state.distcode.copy(state.codes);
|
//state.distcode.copy(state.codes);
|
||||||
// Switch to use dynamic table
|
// Switch to use dynamic table
|
||||||
state.distcode = state.distdyn;
|
state.distcode = state.distdyn;
|
||||||
opts = {bits: state.distbits};
|
opts.bits = state.distbits;
|
||||||
ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
|
ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
|
||||||
// We have separate tables & no pointers. 2 commented lines below not needed.
|
// We have separate tables & no pointers. 2 commented lines below not needed.
|
||||||
// state.next_index = opts.table_index;
|
// state.next_index = opts.table_index;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue