Bug 135703

Summary: EDITING Inserting paragraph before multi page table causes CPU spike
Product: LibreOffice Reporter: NISZ LibreOffice Team <libreoffice>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: minor CC: ilmari.lauhakangas, mattia.b89, nemeth, telesto, xiscofauli
Priority: low Keywords: bibisected, bisected, haveBacktrace, perf, regression
Version: 5.3.0.3 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=125171
https://bugs.documentfoundation.org/show_bug.cgi?id=124795
https://bugs.documentfoundation.org/show_bug.cgi?id=127118
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 104444    
Attachments: Screenshot of the problem in Writer
cannot reproduce the issue
Perf flamegraph
Perf flamegraph

Description NISZ LibreOffice Team 2020-08-13 10:49:49 UTC
Created attachment 164241 [details]
Screenshot of the problem in Writer

If I try to insert a new paragraph before the table in attachment #154864 [details] there is a small ~two seconds delay (on my old-ish laptop) with hourglass icon before the table layout is recalculated. Interestingly deleting the new paragraph and re-adding it is fast, but adding one more new is not.
In 6.4 and before this went much more smoothly.

Steps to reproduce:
    1. Open attachment #154864 [details] 
    2. Add a new paragraph before the table

Actual results:
Each new paragraph takes about two seconds on wait.

Expected results:
Instant result.

LibreOffice details:
Version: 7.1.0.0.alpha0+ (x64)
Build ID: <buildversion>
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: CL

Also in:
Version: 7.0.0.3 (x64)
Build ID: 8061b3e9204bef6b321a21033174034a5e2ea88e
CPU szálak: 4; OS: Windows 6.3 Build 9600; Felületmegjelenítés: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: CL

(in older versions several new paragraphs are need to be added to trigger the bug, also sometimes clicking into the table and out of it)

Verzió: 6.0.0.3
Build az.: 64a0f66915f38c6217de274f0aa8e15618924765
CPU szálak: 4; OS: Windows 6.3; Felületmegjelenítés: alapértelmezett; 
Területi beállítások: hu-HU (hu_HU); Calc: CL

Version: 5.3.0.3
Build ID: 7074905676c47b82bbcfbea1aeefc84afe1c50e1
CPU Threads: 4; OS Version: Windows 6.2; UI Render: GL; Layout Engine: new; 
Locale: en-US (hu_HU); Calc: CL

But not yet in:
Version: 5.2.0.4
Build ID: 066b007f5ebcc236395c7d282ba488bca6720265
CPU Threads: 4; OS Version: Windows 6.2; UI Render: GL; 
Locale: en-US (hu_HU)

Additional Information: 

Bibisected using bibisect-win32-5.3 to:
URL: https://cgit.freedesktop.org/libreoffice/core/commit/?id=8a800eea613c0f5ad3302136766791dc58880fb3
author	Mike Kaganski <mike.kaganski@collabora.com>	2016-12-08 23:01:03 +0300
committer	Andras Timar <andras.timar@collabora.com>	2016-12-12 20:24:29 +0000

tdf#104425 sw: split rows w/large min height (fix layout loop)

Before this it was possible to add so many empty paragraphs that pushed the table to the next page. With this about at the middle of the page several seconds of pause happens. Which is not exactly what happens today.
Comment 1 mattia.b89 2020-08-13 11:11:25 UTC
Can't reproduce it on Arch Linux w/
Version: 6.4.5.2
Build ID: 6.4.5-2
CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3; 
Locale: it-IT (en_GB.UTF-8); UI-Language: en-GB
Calc: threaded

if I try to add a new paragraph (press Enter key)
LO adds new lines instantaneously without CPU spikes
BUT adding new lines do not move table that stays at the original position and new lines will be added in the background of the table

See screenshot
Comment 2 mattia.b89 2020-08-13 11:11:55 UTC
Created attachment 164245 [details]
cannot reproduce the issue
Comment 3 Buovjaga 2022-04-13 17:15:51 UTC
Created attachment 179538 [details]
Perf flamegraph

Took a perf trace of a single new line.
It's still slow.

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 2f2df626117380427d2e5e8417316f52823f1e6f
CPU threads: 8; OS: Linux 5.17; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Comment 4 Buovjaga 2022-04-15 18:08:34 UTC
Created attachment 179592 [details]
Perf flamegraph

I might have absentmindedly used some incorrect version for testing, so uploading a trace taken with an --enable-symbols build

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: b2b821715a3745718a941fa99dda92137c0f0c86
CPU threads: 8; OS: Linux 5.17; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded