Created attachment 188162 [details] Writer file containing numerous Math objects with varying font sizes When editing a Writer document that has many Math formulas, scrolling can become irregular. After examining this with callgrind, I found the reason in vcl/unx/generic/fontmanager/fontconfig.cxx class CachedFontConfigFontOptions. Here the font options cache is coded to a size of 10. Apparently Math formulas can contain a lot of fonts in varying sizes. Thus the font cache is quickly filled. On scrolling, an enormous amount of calls to PrintFontManager::getFontOptions() is generated. Unless cached, these are handled by libfontconfig's FcFontSetMatch(). On typical Ubuntu systems, several thousand fonts can be installed (run fc-list). Thus libfontconfig uses a significant time to handle the calls. Scrolling performance can be greatly improved by increasing the font options cache size to e.g. 100. Since memory usage is probably not as critical as it used to be when the font options cache was first implemented, that should be a safe change. Find attached a sample file with a lot of Math formulas containing different font sizes.
Bug unconfirmed: scroll for me is fluid tested inside Version: 7.5.5.1 (X86_64) / LibreOffice Community Build ID: 2c5e46c1980ec5241359fd65d751dc518205e7af CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win Locale: it-IT (it_IT); UI: it-IT Calc: threaded
(In reply to Jan Rheinländer from comment #0) > Created attachment 188162 [details] > Writer file containing numerous Math objects with varying font sizes Scrolling with the sample document is very fluid with: Version: 7.5.4.2 (X86_64) / LibreOffice Community Build ID: 50(Build:2) CPU threads: 16; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+xcb) Locale: pt-BR (pt_BR.UTF-8); UI: pt-BR Ubuntu package version: 4:7.5.4-0ubuntu0.23.04.1 Calc: threaded I'm on Kubuntu 23.04 under X11. Can you provide more details about your system? Are you on Wayland?
Scrolling seems to be affected in Wayland when using the mouse scroll (not with PgUp/PgDown). I opened the sample document on a Wayland session (Kubuntu 23.04 / Intel graphics) and scrolling is sluggish with the mouse wheel. Scrolling using the PgUp and PgDown keys works as expected.
On my system, all scrolling is sluggish (tried Pg Up / Pg Dn, pulling the scroll bar with the mouse). And the sluggishness disappears when I set the cache from 10 to 100, except for a small delay in the beginning while the cache is being populated (this was tested on my own build of 7.5.3.2.0) I think the number of installed fonts might be relevant. fc-list | wc -l gives me 2415 fonts. Version: 7.3.7.2 / LibreOffice Community Build ID: 30(Build:2) CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3 Locale: de-DE (de_DE.UTF-8); UI: de-DE Ubuntu package version: 1:7.3.7-0ubuntu0.22.04.3 Calc: threaded /etc/lsb-release: Ubuntu 22.04.2 LTS How do I check for Wayland?
Please note that I reported the bug for Linux only. Windows is not affected because it does not use libfontconfig.
Also sluggish for me on Wayland. Jan, if you are on Ubuntu 22.04, you might be using Wayland by default. You can check with the following: 1. Alt+F2, type 'lg', and press Enter 2. Switch to the "Windows" tab 3. In the list, find the line with LO's window title, and click on that line 4. In the opened popup, if you're using Wayland, the first line should have "GType: MetaWindowWayland". If it's "GType: MetaWindowXwayland" (note the extra "X"), then it's x11. Version: 7.5.4.2 (X86_64) / LibreOffice Community Build ID: 36ccfdc35048b057fd9854c757a8b67ec53977b6 CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded Also in 7.4.7.2, but not in 7.3.7.2. So we might be seeing something different, if you see the same issue in 7.3.7.2. See also: - bug 152911 - bug 153111
And for GTK3: bug 154602.
(In reply to Stéphane Guillou (stragu) from comment #6) > Also in 7.4.7.2, but not in 7.3.7.2. So we might be seeing something > different, if you see the same issue in 7.3.7.2. I take that back. I found a regression in performance in 7.1 with choppiness of scroll when formulas are present: 1. Using trackpad scroll, scroll down 1 page and back to the top of the document, fast. I see the canvas having hiccups on the top section's formulas since 7.1, but not in 7.0 - which might be more consistent with what Jan sees. Bibisected with linux-64-7.1 repository to first bad commit c391d02248a86bfc4a57448859eaf70403a365a7 which points to core commit: commit d336e6c26012255015d3fc0caf8e7fafe14bd8f2 author Daniel Arato (NISZ) <arato.daniel@nisz.hu> Mon Aug 24 11:05:17 2020 +0200 committer László Németh <nemeth@numbertext.org> Fri Aug 28 13:13:58 2020 +0200 tdf#69647 sw layout: fix line spacing with inline pictures Line height is now based on (the biggest) font size in the line rather than on the size of the tallest object there, according to ODF and like MSO does. Note: handling of first paragraph line is still different. Co-authored-by: Attila Bánhegyi (NISZ) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101272 Jan, can you please compare versions 7.0 and 7.1 to confirm you are looking at the same issue? https://downloadarchive.documentfoundation.org/libreoffice/old/
Seems I am not using wayland: echo $XDG_SESSION_TYPE results in "x11" The way suggested by Stéphane didn't work, maybe because I am using German KUbuntu.
Unfortunately 7.0 and 7.1 and 7.3 show no difference for me. Apart from the sluggish scrolling, all three will push CPU usage of soffice.bin to 50-90% when dragging the scrollbar with the mouse up and down repeatedly. Interestingly, Xorg CPU usage is < 5% on 7.0 and 7.1 but 10-15% on 7.3
Thanks for checking. I've opened bug 156169 for my findings. Marking my comments here as off-topic.
(In reply to Jan Rheinländer from comment #10) > Unfortunately 7.0 and 7.1 and 7.3 show no difference for me. > > Apart from the sluggish scrolling, all three will push CPU usage of > soffice.bin to 50-90% when dragging the scrollbar with the mouse up and down > repeatedly. > > Interestingly, Xorg CPU usage is < 5% on 7.0 and 7.1 but 10-15% on 7.3 What about to try more modern LibreOffice version like 7.4 or 7.5?
No noticeable improvement with: Version: 7.5.4.2 (X86_64) / LibreOffice Community Build ID: 36ccfdc35048b057fd9854c757a8b67ec53977b6 CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb) Locale: de-DE (de_DE.UTF-8); UI: en-US Calc: threaded and Version: 7.5.5.1 (X86_64) / LibreOffice Community Build ID: 2c5e46c1980ec5241359fd65d751dc518205e7af CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb) Locale: de-DE (de_DE.UTF-8); UI: en-US Calc: threaded
Not reproduced here with 877 fonts. Tempted to set to NEW per comment 3, but on the other hand Rafael could not repro under X11, so we can't be sure it's the same thing... Arch Linux 64-bit, X11 Version: 7.6.0.3 (X86_64) / LibreOffice Community Build ID: 60(Build:3) CPU threads: 8; OS: Linux 6.4; UI render: default; VCL: kf5 (cairo+xcb) Locale: fi-FI (fi_FI.UTF-8); UI: en-US 7.6.0-2 Calc: threaded
One thing we haven't checked is if Jan tried it with a new profile. Jan, can you please test in safe mode with Help > Restart in Safe Mode > Restart > Continue in Safe Mode? If it fixes the issue, you can reset your user profile (keeping in mind will lose settings, personal info and document history) with "Reset to factory settings" in the same dialog. Or rename your user profile directory to keep the older version and restore it if needed. https://wiki.documentfoundation.org/UserProfile#Manual_procedure_(all_versions)
I tested in Safe Mode but could not notice a difference. What did make a difference was reducing the number of installed fonts on my system from >2400 to about 470. I don't think anybody has ever tried to confirm this bug with more than 800 fonts installed?
What kind of "irregular" scrolling should I expect? Scrolling for me in LO is never perfectly "fluid" even with plain text and the default font. Perhaps with this document it takes more processing to scroll, and on a slower machine there is lag? Please explain this better. Otherwise can't really reproduce on: Version: 7.6.0.3 (X86_64) / LibreOffice Community Build ID: 69edd8b8ebc41d00b4de3915dc82f8f0fc3b6265 CPU threads: 4; OS: Linux 6.4; UI render: default; VCL: gtk3 Locale: en-IL (en_IL); UI: en-US ... and I have 6914 fonts according to fc-list.
Since nobody else seems to experience this problem, I would like to close the bug. Probably it is just my old machine coping badly with complex documents.
I didn't experience any abnormal scroll lag in Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: a2265e8faa099d9652efd12392c2877c2df1d1eb CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: default; VCL: win Locale: en-US (en_US); UI: en-US Calc: threaded or Version: 24.2.1.2 (X86_64) / LibreOffice Community Build ID: db4def46b0453cc22e2d0305797cf981b68ef5ac CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: default; VCL: win Locale: en-US (en_US); UI: en-US Calc: threaded
(In reply to Jan Rheinländer from comment #18) > Since nobody else seems to experience this problem, I would like to close > the bug. Probably it is just my old machine coping badly with complex > documents. Marking it as RESOLVED -> NOTOURBUG