Bug 156995 - Selecting a group of many curves is extremely slow in Linux
Summary: Selecting a group of many curves is extremely slow in Linux
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
7.5.5.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:24.2.0
Keywords:
Depends on:
Blocks: Shapes
  Show dependency treegraph
 
Reported: 2023-08-29 21:38 UTC by Peter Bleszynski
Modified: 2024-03-20 16:10 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
example .odp file demonstrating the issue (70.52 KB, application/vnd.oasis.opendocument.presentation)
2023-08-29 21:39 UTC, Peter Bleszynski
Details
Flamegraph (697.69 KB, image/svg+xml)
2023-09-01 09:35 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Bleszynski 2023-08-29 21:38:07 UTC
Description:
It may take up to a minute to select an SVG object that consists of many draw:path> elements within content.xml when selecting with the mouse pointer in the document canvas.  The selection is immediate when selecting the same object in the Navigator pane.

Ubuntu 22.04 and Clear Linux running Gnome and xorg are affected. Possibly other Linuxes are affected as well.  

Xorg appears to make many kernel memcpy calls while LibreOffice is frozen upon selecting the object.

The "slow" SVG object in content.xml follows this syntax:

> <draw:g draw:style-name="gr1">
>     <svg:title>TEST</svg:title>
>     <draw:path draw:style-name="gr2" draw:text-style-name="P1" draw:layer="layout" svg:width="20.723cm" svg:height="14.884cm" svg:x="6.298cm" svg:y="0.026cm" svg:viewBox="0 0 20724 14885" svg:d="...">
>         <text:p/>
>     </draw:path>
>     <draw:path draw:style-name="gr3" draw:text-style-name="P2" draw:layer="layout" svg:width="0.235cm" svg:height="0.19cm" svg:x="6.294cm" svg:y="0.116cm" svg:viewBox="0 0 236 191" svg:d="...">
>         <text:p/>
>     </draw:path>
>     
> ... repeat the above <draw:path> elements a few hundred times ...
> 
> </draw:g>


Steps to Reproduce:
On Linux, select an SVG object that consists of many paths in content.xml

Actual Results:
Selection take a very long time, depending on complexity and number of elements in the group.

Expected Results:
Selection should be quick


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Does not seem to affect Windows
Comment 1 Peter Bleszynski 2023-08-29 21:39:30 UTC
Created attachment 189235 [details]
example .odp file demonstrating the issue
Comment 2 Julien Nabet 2023-08-30 06:35:43 UTC
On which LO version are you?
You may find recent LO version here:
https://launchpad.net/~libreoffice/+archive/ubuntu/ppa
Comment 3 Peter Bleszynski 2023-08-30 06:46:22 UTC
Clear Linux

$ soffice --version
LibreOffice 7.6.0.3 60(Build:3)


Ubuntu 22.04

$ soffice --version
LibreOffice 7.5.5.2 50(Build:2)
Comment 4 Julien Nabet 2023-08-30 07:44:43 UTC
Thank you for the quick feedback, I put it back to UNCONFIRMED.

Xisco: thought you might be interested in this one since it concerns svg.
If useful, I can provide a Flamegraph.
Comment 5 Telesto 2023-08-30 19:32:16 UTC
Selecting speed is so, so on Windows. Shrinking the shape is slow; dragging (the shrinked) shape is also slow
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: c9916d9be9c060d43fc063b76d70629162650fea
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL threaded
Comment 6 Telesto 2023-08-30 19:35:06 UTC
(In reply to Telesto from comment #5)
> Selecting speed is so, so on Windows. Shrinking the shape is slow; dragging
> (the shrinked) shape is also slow
> Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
> Build ID: c9916d9be9c060d43fc063b76d70629162650fea
> CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
> Locale: nl-NL (nl_NL); UI: en-US
> Calc: CL threaded

Even worse in
Versie: 4.4.7.2 
Build ID: f3153a8b245191196a4b6b9abd1d0da16eead600
Locale: nl_NL
Comment 7 Peter Bleszynski 2023-08-30 23:16:07 UTC
Selection seems immediate in Windows and MacOS in recent versions of LO.  

It's interesting that Linux select in Navigator is fast while select in document canvas is very slow.
Comment 8 Peter Bleszynski 2023-08-30 23:55:36 UTC
Slow selecting occurs in every Linux I have tested so far.

Clear Linux

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: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

Ubuntu 22.04 #1 (standard kernel)

Version: 7.5.5.2 (X86_64) / LibreOffice Community
Build ID: 50(Build:2)
CPU threads: 16; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Ubuntu package version: 4:7.5.5~rc2-0ubuntu0.22.04.1~lo1
Calc: threaded

Ubuntu 22.04 #2 (hwe kernel)

Version: 7.5.5.2 (X86_64) / LibreOffice Community
Build ID: 50(Build:2)
CPU threads: 8; OS: Linux 6.2; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Ubuntu package version: 4:7.5.5~rc2-0ubuntu0.22.04.1~lo1
Calc: threaded


It's also slow in a clean install of Ubuntu 23.04.
Comment 9 Xisco Faulí 2023-09-01 07:57:20 UTC
(In reply to Julien Nabet from comment #4)
> Thank you for the quick feedback, I put it back to UNCONFIRMED.
> 
> Xisco: thought you might be interested in this one since it concerns svg.
> If useful, I can provide a Flamegraph.

Hi Julien,
Yes, could you please do so ? Thanks in  advance
Comment 10 Julien Nabet 2023-09-01 09:35:21 UTC
Created attachment 189301 [details]
Flamegraph

Here's a Flamegraph retrieved on pc Debian x86-64 with master sources updated today + gen rendering.
Comment 11 Peter Bleszynski 2023-09-05 00:16:42 UTC
I'm curious why this bug is associated with OLE.

A simple curve drawn in Impress or Draw, then duplicated ~1000 times and grouped causes extreme slowness in select, de-select, Navigator pane updates, file save, etc.

The slowness seems to be many times worse in Linux than in Windows and MacOS.
Comment 12 Noel Grandin 2023-09-13 12:25:42 UTC
For the benefit of any other coders that come along, I took a brief look, and the problem is that when we select the group object, we initially think we are going to do a drag, and we then spend a very long time constructing a complicated "drag view" of the group object.

So there are two problems

(1) we should really not be constructing a drag object when we are selecting
(2) we should probably just construct an outline of the object to display while dragging, instead of trying to draw the whole thing.
Comment 13 Commit Notification 2023-09-13 13:43:40 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9f4ccc63346b26d8d774b22124da0842ef18e0bc

tdf#156995 speed up dragging complex group objects

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Peter Bleszynski 2023-09-14 04:59:25 UTC
Thanks for looking at this.  I have not looked at the daily build yet.  However, I noticed a difference in "drag view" behavior across Windows and Linux.

Is it intentional that Linux, unlike Win_x86-64, has no limits on the number of curve points when drawing drag previews? Are these limits set differently based on operating system? Are they dependent on hardware or settings?

In Windows, a rectangular bounding box is drawn instead of a "real" drag view when dragging a group of Bézier curves having more than a total of 500 points.  The limit appears to be 200 points for a selection of curves (as opposed to a selected group of curves).

In Linux, there appears to be no upper limit to the number of points and LO tries to generate a "real" drag view regardless of the complexity of the group object.