1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Add caching to reduce the number of Ref objects

This is similar to the existing caching used to reduced the number of `Cmd` and `Name` objects.
With the `tracemonkey.pdf` file, this patch changes the number of `Ref` objects as follows (in the default viewer):

|          | Loading the first page | Loading *all* the pages |
|----------|------------------------|-------------------------|
| `master` | 332                    | 3265                    |
| `patch`  | 163                    | 996                     |
This commit is contained in:
Jonas Jenwald 2019-05-25 17:40:14 +02:00
parent d95145953c
commit 2fe9f3ff8f
9 changed files with 103 additions and 88 deletions

View file

@ -1697,7 +1697,7 @@ var XRef = (function XRefClosure() {
fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
var tableOffset = xrefEntry.offset;
var stream = this.fetch(new Ref(tableOffset, 0));
var stream = this.fetch(Ref.get(tableOffset, 0));
if (!isStream(stream)) {
throw new FormatError('bad ObjStm stream');
}