summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-xref.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-02-23 15:11:08 +0100
committerTor Andersson <tor.andersson@artifex.com>2017-03-01 15:22:46 +0100
commit53f816f2f06de5aeb13cac72232c4f52714201cb (patch)
tree924eccc6f31db7564ab434a3491b27c7d572eed3 /source/pdf/pdf-xref.c
parent8c547d302fb23950bc3f928a37d4c8baf93838cc (diff)
downloadmupdf-53f816f2f06de5aeb13cac72232c4f52714201cb.tar.xz
Add page lookup cache for faster link destination lookups in outlines.
Loading outlines wants to look up all link destinations, and doing the normal link destination lookups triggers loading all page objects used. This means we need to parse a lot of objects, which can be quite slow. We can load the page tree faster by only looking at intermediate page tree nodes. If we load the page tree and create a reverse lookup table for use when loading the outline, we can speed up the time to run 'mutool show pdfref17.pdf outline' from 900ms to 100ms.
Diffstat (limited to 'source/pdf/pdf-xref.c')
-rw-r--r--source/pdf/pdf-xref.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index 739a5693..e7278ae8 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -1528,6 +1528,8 @@ pdf_drop_document_imp(fz_context *ctx, pdf_document *doc)
pdf_drop_obj(ctx, doc->orphans[i]);
fz_free(ctx, doc->orphans);
+
+ fz_free(ctx, doc->rev_page_map);
}
fz_always(ctx)
{