Sumatrapdf: PDF file with large toc is slow to load

Created on 29 Oct 2020  路  7Comments  路  Source: sumatrapdfreader/sumatrapdf

I literally just downloaded, installed, and opened 110MB file with Adobe Reader all before Sumatra opened the file.

Both Adobe and mupdf open the file pretty much immediately.

What gives? Very frustrating.

All 7 comments

Depends on the file, so I suggest you provide a sample link to such a file that can be tested or else this issue is likely to get closed quite soon. Also, do test the same file with the latest daily version once and report back, since that contains the latest MuPDF updates incorporated into Sumatra.

It will be tricky to provide as it is not mine but a client's file. Doesn't really contain anything too sensitive but it's not my property to be distributing. I can say it is 5473 pages long with a lot of bookmarks and links. It's an electrical schematic so there are a lot of lines that are connected to other lines with links.

The daily version does not open the file quickly either. It shows the number of pages and then goes unresponsive.

As you can see from the Actions tab above there are regular MuPDF updates being incorporated into Sumatra. I'm not sure which version of MuPDF is being used right now, but it should be the latest i.e. 1.18.0. After a reboot and without the file being opened with any other program beforehand (to rule out any prior caching), how quickly does MuPDF 1.18.0 manage to load the PDF completely?

Unfortunately, without a file to actually test with, it might be impossible for the dev to progress given only such a vague description. If possible, perhaps you can mail it to the dev directly (see here for instructions) and he can look into the issue while maintaining confidentiality.

MuPDF 1.8.0 for Windows opens the file in about 3 seconds after a reboot.

I've emailed the dev in the link you provided. Thanks.

I've looked at the profile for the file.

It's a file with over 5k pages and large table of contents. The code takes most of the time in PopulateTreeItem:

Function Name       Total CPU [unit, %] Self CPU [unit, %]  Module  Category
PopulateTreeItem    44591 (94.24%)  3 (0.01%)   SumatraPDF.exe  UI | IO | Kernel
  insertItem        23674 (50.04%)  1 (0.00%)   SumatraPDF.exe  UI | IO | Kernel
  TocItem::ChildAt  20474 (43.27%)  20469 (43.26%)  SumatraPDF.exe  Kernel
  PopulateTreeItem  435   (0.92%)   0 (0.00%)   SumatraPDF.exe  UI | IO | Kernel

To make a significant improvement, would probably have to move to "virtual" Tree i.e. avoid inserting all tree items, just insert those that are currently visible and then insert the rest on demand.

@kjk
could this tree behaviour be related to https://github.com/sumatrapdfreader/sumatrapdf/issues/1786 ?

It's a different issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gblazex picture gblazex  路  7Comments

yozhic picture yozhic  路  5Comments

kloked picture kloked  路  6Comments

Gugus99 picture Gugus99  路  3Comments

banbonic picture banbonic  路  4Comments