mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58: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:
parent
d95145953c
commit
2fe9f3ff8f
9 changed files with 103 additions and 88 deletions
|
@ -627,7 +627,7 @@ class PDFDocument {
|
|||
const { catalog, linearization, } = this;
|
||||
assert(linearization && linearization.pageFirst === pageIndex);
|
||||
|
||||
const ref = new Ref(linearization.objectNumberFirst, 0);
|
||||
const ref = Ref.get(linearization.objectNumberFirst, 0);
|
||||
return this.xref.fetchAsync(ref).then((obj) => {
|
||||
// Ensure that the object that was found is actually a Page dictionary.
|
||||
if (isDict(obj, 'Page') ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue