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
|
@ -494,7 +494,7 @@ var WorkerMessageHandler = {
|
|||
});
|
||||
|
||||
handler.on('GetPageIndex', function wphSetupGetPageIndex(data) {
|
||||
var ref = new Ref(data.ref.num, data.ref.gen);
|
||||
var ref = Ref.get(data.ref.num, data.ref.gen);
|
||||
var catalog = pdfManager.pdfDocument.catalog;
|
||||
return catalog.getPageIndex(ref);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue