mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +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
|
@ -150,7 +150,7 @@ class Parser {
|
|||
if (Number.isInteger(buf1)) { // indirect reference or integer
|
||||
const num = buf1;
|
||||
if (Number.isInteger(this.buf1) && isCmd(this.buf2, 'R')) {
|
||||
const ref = new Ref(num, this.buf1);
|
||||
const ref = Ref.get(num, this.buf1);
|
||||
this.shift();
|
||||
this.shift();
|
||||
return ref;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue