From 53f816f2f06de5aeb13cac72232c4f52714201cb Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 23 Feb 2017 15:11:08 +0100 Subject: 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. --- source/pdf/pdf-xref.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/pdf/pdf-xref.c') 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) { -- cgit v1.2.3