Bug 474299 - Typing long text in PDF forms extremely slow
Summary: Typing long text in PDF forms extremely slow
Status: RESOLVED WORKSFORME
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 23.04.3
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-08 13:27 UTC by Louis Moureaux
Modified: 2023-09-20 18:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Profile (83.60 KB, image/png)
2023-09-08 13:27 UTC, Louis Moureaux
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Louis Moureaux 2023-09-08 13:27:05 UTC
Created attachment 161510 [details]
Profile

SUMMARY
When editing a (specific) PDF form with a "free text" field, typing is extremely slow with okular at 100% CPU usage (multiple seconds per character). A quick profile shows Poppler::FormFieldText::setText(QString) as the main culprit, apparently reloading fonts and querying FontConfig in the process.
Okular shouldn't call this function on every edit (and I suspect even for every letter in the text, else it wouldn't be so slow).

STEPS TO REPRODUCE
1. Open a PDF form with a multiline text field (I can test patches/share mine privately if needed)
2. Try to type some text

OBSERVED RESULT
Wait for 5 seconds per letter you type

EXPECTED RESULT
Editing test is instant

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.27
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
Kernel Version: 6.2.0-31-generic (64-bit)
Graphics Platform: Wayland
Comment 1 Louis Moureaux 2023-09-08 13:38:04 UTC
Duh just checked 23.08 and it's fixed there. Thank you for this and sorry for the noise!
Comment 2 Sune Vuorela 2023-09-20 18:45:39 UTC
Mostly for other people who finds this:

This was iirc fixed in poppler 23.06.  https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1384/diffs was a big part of it, but there was a few more fixes here and there.