Internal PDF import spends forever on ICC color space parsing
Summary:
I have a CorelDraw generated PDF file which takes about 10 seconds to load with "Poppler/Cairo import" method, but takes forever with "Internal import" method. Random interruptions of the process indicate that most of the time is spend for ICC color space parsing. For example:
#0 0x00007ffff54db495 in FlateStream::readSome() () at /usr/lib/libpoppler.so.102
#1 0x00007ffff54db703 in FlateStream::getChars(int, unsigned char*) () at /usr/lib/libpoppler.so.102
#2 0x00007ffff54843b3 in GfxICCBasedColorSpace::parse(Array*, OutputDev*, GfxState*, int) () at /usr/lib/libpoppler.so.102
#3 0x00007ffff5485db8 in GfxColorSpace::parse(GfxResources*, Object*, OutputDev*, GfxState*, int) () at /usr/lib/libpoppler.so.102
#4 0x00007ffff6f2ea8a in PdfParser::opSetFillColorSpace(Object*, int) (this=0x555556bacf40, args=0x7fffffffda90) at ../src/extension/internal/pdfinput/pdf-parser.cpp:1094
There are only 5 color spaces defined in the file, caching the result of GfxColorSpace::parse
would fix the problem.
Steps to reproduce:
- open Inkscape
- File > Open... > select PDF with many ICC color space references
- Keep default PDF import settings, in particular "Internal import"
- Click OK
What happened?
Inkscape freezes
What should have happened?
Import time should be comparable to Poppler/Cairo method.
Inkscape Version and Operating System:
- Inkscape Version:
1.1-dev (97c5de14bd, 2020-09-20, custom)
- Operating System: Arch Linux