Very slow rendering of the Lyon public transit map with lots of vector shapes
Hi! I have encountered a single-page PDF file that takes a very long time (over 25 seconds on my old desktop workstation) to render with any Poppler-based PDF viewer, including Okular 24.12.0 from Fedora 41 with Poppler 24.08.0, running on the Wayland GNOME 47.2 session.
Here is the sample file: lyon_metro.pdf (provided by @hadess in a downstream issue about loading progress indication)
Short of doing multi-threaded processing with #1503, I am wondering if there is something special going on with the single-threaded rendering of this file, that would have potential to be optimized. While Okular/Poppler takes 26 seconds to render this document on that machine, Firefox's PDFjs is able to render it in 6 seconds (and XPDF 4.05 is able to render it in 15 seconds).
I have profiled Okular rendering the file. Here is the recorded profile from Sysprof 47: Sysprof_47_standalone_capture_of_Okular_24.12_rendering_the_Lyon_transit_map.tar.xz
For your convenience, below are some screenshots of what I presume are the most interesting views of that profile.
Flame graph of the most expensive function calls:
CPU usage per core:
Graphics damage/redraws:
What's going on across the whole graphics stack: