Bug 350798 - Okular opens large PDFs very slowly
Summary: Okular opens large PDFs very slowly
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 0.19.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2015-07-30 18:11 UTC by Ruslan Kabatsayev
Modified: 2024-06-09 22:31 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Sysprof log (211.65 KB, application/x-bzip)
2015-07-31 18:47 UTC, Ruslan Kabatsayev
Details
video of slow PDF page rendering (3.68 MB, video/x-matroska)
2022-04-06 04:55 UTC, Alan Aversa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ruslan Kabatsayev 2015-07-30 18:11:10 UTC
Try e.g. this document: http://tinyurl.com/p3su6cp . (It's Intel's System Programming Guide). It opens in about 25 seconds on my machine with Okular. For comparison, Adobe Reader 9.5.1 opens this same document nearly instantly — less than in one second!

Reproducible: Always

Steps to Reproduce:
1. Download the example document linked above
2. Try opening it with Okular
3. Wait until it shows the first page
4. (optional) Try the same in Adobe Reader and see how amazingly fast it shows the document

Actual Results:  
First page showed after ~25 seconds waiting for seemingly hung Okular

Expected Results:  
The document should open nearly instantly, as is the case with Adobe Reader.

This was checked on Kubuntu 12.04 with its stock KDE and Kubuntu 14.04 with its stock KDE version. User experience is the same.
Comment 1 Burkhard Lück 2015-07-30 18:29:08 UTC
Kubuntu 14.10 utopic
$ okular --version
Qt: 4.8.6
KDE: 4.14.2
Okular: 0.20.2
libpoppler-qt4-4:
Installiert:           0.26.5-0ubuntu2

~ 3 or 4 seconds to display the downloaded pdf (9 MB)
Comment 2 Albert Astals Cid 2015-07-30 23:22:19 UTC
Which poppler version are you using?
Comment 3 Ruslan Kabatsayev 2015-07-31 04:03:15 UTC
0.24.5-2ubuntu4 on Kubuntu 14.04
0.18.4-1ubuntu3.1 on Kubuntu 12.04
0.33.0 on LFS

All they show qualitatively the same problem.
Comment 4 Albert Astals Cid 2015-07-31 09:22:28 UTC
Do you have a remote printer that is unplugged?
Comment 5 Ruslan Kabatsayev 2015-07-31 10:16:51 UTC
All remote printers I have are plugged in. But the problem also reproduces with network down.
Comment 6 Albert Astals Cid 2015-07-31 11:18:59 UTC
Is okular using 100% of your CPU? Or just sitting there doing nothing?
Comment 7 Ruslan Kabatsayev 2015-07-31 11:23:29 UTC
Uses 100% of a single core (i.e. 25% total on a quad-core machine).
Comment 8 Ruslan Kabatsayev 2015-07-31 11:28:44 UTC
Just tried running sysprof with it, it appears to take most of the time in DecryptStream::lookChar(). On the machine I'm now, with Kubuntu 14.04, it takes 4-5 seconds to open the file, within which sysprof did the sampling.
Comment 9 Albert Astals Cid 2015-07-31 13:24:53 UTC
I'm confused now, you're saying that it takes 5 seconds or 25?
Comment 10 Ruslan Kabatsayev 2015-07-31 13:31:50 UTC
On one machine (LFS with poppler 0.33.0) it takes 25 seconds, on this one (Kubuntu 14.04 with poppler 0.24.5) it's 5.
Comment 11 Albert Astals Cid 2015-07-31 13:51:54 UTC
Did you do the sysprof sampling in that machine that is fast? Why?
Comment 12 Ruslan Kabatsayev 2015-07-31 14:26:34 UTC
Yes, I did it on the fast one, because it's near me. I'll get to the other one after several hours. Should I try profiling there too?
Comment 13 Albert Astals Cid 2015-07-31 14:42:37 UTC
Yes, i'm not interested in profiling on a computer where there's nothing to fix.
Comment 14 Ruslan Kabatsayev 2015-07-31 15:07:46 UTC
So you consider 5 seconds vs almost instant as in Adobe Reader a negligible difference?
Comment 15 Albert Astals Cid 2015-07-31 15:19:51 UTC
Do you consider 25 seconds vs 5 seconds a negligible difference?
Comment 16 Ruslan Kabatsayev 2015-07-31 18:47:19 UTC
Created attachment 93820 [details]
Sysprof log

OK, now I got to this machine with 25 seconds opening. Here the log is more verbose due to better-installed debug symbols or whatever (and it doesn't contradict my observations on the faster machine). I attach the syslog saved log.
Comment 17 Albert Astals Cid 2015-07-31 20:10:21 UTC
The big slowliness has been fixed by the newer poppler release as we can see. 

I can't see any huge difference between the time Adobe takes to open the file and the time Okular takes to open the file in my system.

We can leave this open in case you feel the difference is bad but i wouldn't hold my breath on getting someone to look at it. Maybe you can? You seem to know a bit about technical stuff.
Comment 18 Ruslan Kabatsayev 2015-07-31 20:16:11 UTC
If I'm not mistaken, 0.33 should be newer than 0.24. Am I wrong?
Comment 19 Ruslan Kabatsayev 2015-08-01 15:56:12 UTC
@Albert
What time does it take for Okular to open the file on your system? And what OS, poppler and Okular versions are you using? I can't seem to figure out in which version of what it should work without slowdowns. All systems I tried appeared too slow to me (5 seconds is also slow, since even MuPDF opens it instantly, even on the machine with Okular's 25 seconds.)
Comment 20 Albert Astals Cid 2015-08-10 22:41:26 UTC
(In reply to Ruslan Kabatsayev from comment #18)
> If I'm not mistaken, 0.33 should be newer than 0.24. Am I wrong?

No, you're correct.


(In reply to Ruslan Kabatsayev from comment #19)
> @Albert
> What time does it take for Okular to open the file on your system? And what
> OS, poppler and Okular versions are you using? I can't seem to figure out in
> which version of what it should work without slowdowns. All systems I tried
> appeared too slow to me (5 seconds is also slow, since even MuPDF opens it
> instantly, even on the machine with Okular's 25 seconds.)

4 seconds. poppler 0.35 Okular 0.22.90

mupdf opens it instantly because it basically does "nothing"

poppler/qt4/tests/test-poppler-qt4 also opens it in 86 milisseconds, but showing the big table of contents, etc is costly.

I'd say there's something wrong in your LFS build.
Comment 21 Blase Johnson 2018-11-17 18:50:26 UTC
Does it still take you a long time to open the document with a more recent version of Okular?
Comment 22 Ruslan Kabatsayev 2018-11-17 19:23:12 UTC
(In reply to Blase Johnson from comment #21)
> Does it still take you a long time to open the document with a more recent
> version of Okular?

Still 4 seconds with the document from comment 0 on Kubuntu 18.04. And I don't have any TOC panel open.
Comment 23 Blase Johnson 2018-11-18 03:58:48 UTC
I can open that document in about 2 seconds.
Comment 24 Bug Janitor Service 2018-12-03 03:44:18 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 25 Christoph Feck 2018-12-05 01:30:25 UTC
The information requested in comment #21 was added with comment #22; changing status for inspection.
Comment 26 2wxsy58236r3 2021-07-21 04:05:55 UTC
There is a way to use MuPDF as backend in Okular, [1] and it can render the pages in the test document (Intel's System Programming Guide) very quickly.

[1] https://github.com/gustawho/okular-backend-mupdf
Comment 27 Alan Aversa 2022-04-06 04:55:10 UTC
Created attachment 147993 [details]
video of slow PDF page rendering

Okular 21.12.3
Qt Versione 5.15.3 (compilato con 5.15.3)
KDE Frameworks Versione 5.92.0

I get this slow PDF page rendering issue on recently-scanned Archive.org PDFs. Not all scanned PDFs have this issue for me; it seems to be just the ones with layers. (DjVus are much faster!)
Comment 28 Richard Llom 2024-06-09 22:31:28 UTC
pdf from comment #0 opens instantly in okular 24.05.0