Bug 127260 - Saving files containing XOR-mode drawing is extremely slow
Summary: Saving files containing XOR-mode drawing is extremely slow
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
6.2.5.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: haveBacktrace, perf
Depends on:
Blocks: Performance
  Show dependency treegraph
 
Reported: 2019-09-01 10:07 UTC by David
Modified: 2022-12-29 05:58 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
File that takes forever to save after adding gradients (22.56 KB, application/vnd.oasis.opendocument.graphics)
2019-09-01 10:07 UTC, David
Details
perf flamegraph (66.99 KB, application/x-bzip)
2019-09-01 20:16 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David 2019-09-01 10:07:52 UTC
Created attachment 153792 [details]
File that takes forever to save after adding gradients

The attached file began to require 30 seconds+ runtime to save after beginning to colour its boxes with gradients. The program otherwise works perfectly -- it looks like some kind of slow algorithm is causing it.

OS is Ubuntu 19.04, HiDPI (XPS 9550)

The responsible stack appears to always be the main thread, and the trace always resembles below. This trace was taken on 6.2.5.2, but I have confirmed the bug still manifests in latest release



[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fe1154e4729 in __GI___poll (fds=0x7fff3c0a4b68, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
29	../sysdeps/unix/sysv/linux/poll.c: No such file or directory.
(gdb) bt
#0  0x00007fe1154e4729 in __GI___poll (fds=0x7fff3c0a4b68, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007fe1107de917 in  () at /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007fe1107e025f in  () at /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007fe1107e03d1 in xcb_wait_for_reply64 () at /usr/lib/x86_64-linux-gnu/libxcb.so.1
#4  0x00007fe114663e38 in _XReply () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#5  0x00007fe11465f8bd in XSync () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#6  0x00007fe11372d43e in  () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#7  0x00007fe11372e220 in  () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#8  0x00007fe11372b25a in  () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#9  0x00007fe113700e54 in  () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#10 0x00007fe1136c1ebf in  () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#11 0x00007fe1136c234e in  () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#12 0x00007fe1136f4cdc in  () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#13 0x00007fe1136f545e in  () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#14 0x00007fe1136f54dc in  () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#15 0x00007fe1136b0861 in  () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#16 0x00007fe113701068 in  () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#17 0x00007fe1136b8606 in  () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#18 0x00007fe11370de35 in cairo_paint () at /usr/lib/x86_64-linux-gnu/libcairo.so.2
#19 0x00007fe1184ed442 in SvpSalGraphics::releaseCairoContext(_cairo*, bool, basegfx::B2DRange const&) const () at /usr/lib/libreoffice/program/libmergedlo.so
#20 0x00007fe1184f0864 in SvpSalGraphics::drawPolyPolygon(basegfx::B2DHomMatrix const&, basegfx::B2DPolyPolygon const&, double) ()
    at /usr/lib/libreoffice/program/libmergedlo.so
#21 0x00007fe1184eb564 in SvpSalGraphics::drawPolygon(unsigned int, SalPoint const*) () at /usr/lib/libreoffice/program/libmergedlo.so
#22 0x00007fe11827c955 in  () at /usr/lib/libreoffice/program/libmergedlo.so
#23 0x00007fe11829bf68 in  () at /usr/lib/libreoffice/program/libmergedlo.so
#24 0x00007fe11829f13c in OutputDevice::DrawGradient(tools::PolyPolygon const&, Gradient const&) () at /usr/lib/libreoffice/program/libmergedlo.so
#25 0x00007fe11829f1ab in OutputDevice::DrawGradient(tools::Rectangle const&, Gradient const&) () at /usr/lib/libreoffice/program/libmergedlo.so
#26 0x00007fe11830d849 in GDIMetaFile::Play(OutputDevice*, unsigned long) () at /usr/lib/libreoffice/program/libmergedlo.so
#27 0x00007fe11830dac0 in GDIMetaFile::Play(OutputDevice*, Point const&, Size const&) () at /usr/lib/libreoffice/program/libmergedlo.so
#28 0x00007fe11830de81 in GDIMetaFile::CreateThumbnail(BitmapEx&, BmpConversion, BmpScaleFlag) const () at /usr/lib/libreoffice/program/libmergedlo.so
#29 0x00007fe11726b7dd in  () at /usr/lib/libreoffice/program/libmergedlo.so
#30 0x00007fe11726be38 in  () at /usr/lib/libreoffice/program/libmergedlo.so
#31 0x00007fe1175bb785 in SfxBroadcaster::Broadcast(SfxHint const&) () at /usr/lib/libreoffice/program/libmergedlo.so
#32 0x00007fe11720e796 in  () at /usr/lib/libreoffice/program/libmergedlo.so
#33 0x00007fe118439400 in Scheduler::ProcessTaskScheduling() () at /usr/lib/libreoffice/program/libmergedlo.so
#34 0x00007fe10e2ac66a in  () at /usr/lib/libreoffice/program/libvclplug_gtk3lo.so
#35 0x00007fe114b8d898 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#36 0x00007fe114b8dc88 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#37 0x00007fe114b8dd1c in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#38 0x00007fe10e2adb53 in  () at /usr/lib/libreoffice/program/libvclplug_gtk3lo.so
#39 0x00007fe118447812 in  () at /usr/lib/libreoffice/program/libmergedlo.so
#40 0x00007fe118449595 in Application::Execute() () at /usr/lib/libreoffice/program/libmergedlo.so
--Type <RET> for more, q to quit, c to continue without paging--c
#41 0x00007fe1174ff243 in  () at /usr/lib/libreoffice/program/libmergedlo.so
#42 0x00007fe11844fd22 in ImplSVMain() () at /usr/lib/libreoffice/program/libmergedlo.so
#43 0x00007fe11751d321 in soffice_main () at /usr/lib/libreoffice/program/libmergedlo.so
#44 0x000055ab5627c07b in  ()
#45 0x00007fe1153f9b6b in __libc_start_main (main=0x55ab5627c070, argc=4, argv=0x7fff3c0a7618, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7fff3c0a7608) at ../csu/libc-start.c:308
#46 0x000055ab5627c0ba in  ()
(gdb)
Comment 1 David 2019-09-01 10:27:11 UTC
Disabling thumbnails in expert settings 'fixes' the problem

Tools -> Options -> Advanced -> Expert

Search for 'thumbnail'
Disable 'GenerateThumbnail'
Disable 'RecentDocsThumbnail'
Comment 2 Julien Nabet 2019-09-01 20:16:56 UTC
Created attachment 153800 [details]
perf flamegraph

On pc Debian x86-64 with master sources updated today, I retrieved a Flamegraph perf
Comment 3 Buovjaga 2020-04-18 14:47:15 UTC
Saving attachment 153792 [details] is instant for me. Did not need to touch expert options.

Maybe try with 6.4 or a master build.

https://dev-builds.libreoffice.org/daily/master/current.html
https://wiki.documentfoundation.org/Installing_in_parallel/Linux

Arch Linux 64-bit
Version: 7.0.0.0.alpha0+
Build ID: b267650fd097f16d1b31c87a11a497294ad4ee42
CPU threads: 8; OS: Linux 5.6; UI render: default; VCL: kf5; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 15 April 2020
Comment 4 David 2020-04-18 15:19:14 UTC
Problem still persists in master~2020-04-17_19.45.21_LibreOfficeDev_7.0.0.0.alpha0_Linux_x86-64_deb.tar.gz
Comment 5 Buovjaga 2020-04-18 15:33:38 UTC
Hmm, it seems to be a bit slower with gtk3, but still taking maybe only 5 seconds for me.
Comment 6 David 2020-04-18 15:44:29 UTC
Given how 'glaringly obvious' this bug is, that it interacts with the graphics stack, and generally poor support for HiDPI on Linux, my money would be on some rasterization task having 4x more work to do on a HiDPI machine, or something similar.

Your 5 seconds report multiplied by 4 starts getting close to the delays I'm seeing.
Comment 7 Telesto 2020-04-18 20:39:18 UTC
(In reply to David from comment #4)
> Problem still persists in
> master~2020-04-17_19.45.21_LibreOfficeDev_7.0.0.0.alpha0_Linux_x86-64_deb.
> tar.gz

Same backend?

It's only slow for me with Skia backend Raster & Vulcan (Windows)
Version: 7.0.0.0.alpha0+ (x64)
Build ID: 4475bcd83aac7e033fc5250f268eb922bd471e7b
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Vulkan; VCL: win; 
Locale: nl-NL (nl_NL); UI-Language: en-US
Calc: CL
Comment 8 Luboš Luňák 2020-04-20 13:15:36 UTC
This is not about gradients but XOR-mode drawing. Our Cairo code applies the XOR operation after each drawing call, and the document results in a large number of polygon drawing in XOR mode.

For Skia I've handled this by delaying XOR updates until the XOR mode is left (https://git.libreoffice.org/core/commit/3974dfee554bda82fdfb89cd4a2ea8926eb31243).
Comment 9 QA Administrators 2022-04-21 03:39:45 UTC
Dear David,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug