mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-29 15:47:57 +02:00
When decoding a stream, the decode buffer is often grown multiple times, its byte size increasing like so: 512, 1024, 2048, etc. This patch estimates the minimum size in advance (using the length of the encoded stream), often allowing the smaller sizes to be skipped. It also renames numerous |length| variables as |maybeLength| to make it clear that they can be |null|. I measured this change on eight documents. This change reduces the cumulative size of decode buffer allocations by 0--32%, with 10--20% being typical. This reduces peak RSS by 10 or 20 MiB for several of them. |
||
---|---|---|
.. | ||
api_spec.js | ||
cmap_spec.js | ||
crypto_spec.js | ||
evaluator_spec.js | ||
font_spec.js | ||
function_spec.js | ||
metadata_spec.js | ||
obj_spec.js | ||
parser_spec.js | ||
stream_spec.js | ||
testreporter.js | ||
unit_test.html | ||
util_spec.js |