1cd9a28c81
Given that the different types of `Stream`s will never be cached, this thus implies that the `XRef.cache` Array will *always* be more-or-less sparse. Generally speaking, the longer the document the more sparse the `XRef.cache` will thus become. For example, looking at the `pdf.pdf` file from the test-suite: The length of the `XRef.cache` Array will be a few hundred thousand elements, with approximately 95% of them being empty. Hence it seems pretty clear that an Array isn't really the best data-structure for this kind of cache, and this patch thus changes it to a Map instead. This patch-series was tested using the PDF file from issue 2618, i.e. http://bugzilla-attachments.gnome.org/attachment.cgi?id=226471, with the following manifest file: ``` [ { "id": "issue2618", "file": "../web/pdfs/issue2618.pdf", "md5": "", "rounds": 200, "type": "eq" } ] ``` which gave the following results when comparing this patch-series against the `master` branch: ``` -- Grouped By browser, stat -- browser | stat | Count | Baseline(ms) | Current(ms) | +/- | % | Result(P<.05) ------- | ------------ | ----- | ------------ | ----------- | --- | ----- | ------------- Firefox | Overall | 200 | 2736 | 2736 | 1 | 0.02 | Firefox | Page Request | 200 | 2 | 2 | 0 | -8.26 | faster Firefox | Rendering | 200 | 2733 | 2734 | 1 | 0.03 | ``` |
||
---|---|---|
.. | ||
core | ||
display | ||
images | ||
shared | ||
doc_helper.js | ||
interfaces.js | ||
license_header_libre.js | ||
license_header.js | ||
pdf.image_decoders.js | ||
pdf.js | ||
pdf.worker.entry.js | ||
pdf.worker.js | ||
worker_loader.js |