Bug 161846 - Saving a ODS with plenty of comments very slow; massive amount of CPU time spend in SfxItemPool::GetItemSurrogates
Summary: Saving a ODS with plenty of comments very slow; massive amount of CPU time sp...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
25.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:25.2.0
Keywords: perf, possibleRegression
Depends on:
Blocks: Calc-Comments Performance
  Show dependency treegraph
 
Reported: 2024-06-30 10:25 UTC by Telesto
Modified: 2024-07-31 11:58 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2024-06-30 10:25:05 UTC
Description:
Saving a ODS with plenty of comments very slow; massive amount of CPU time spend in SfxItemPool::GetItemSurrogates(std::__1::vector<SfxPoolItem const*, std::__1::allocator<SfxPoolItem const*>>&, unsigned short) const

Steps to Reproduce:
1. Open attachment 144526 [details] (bug 119075)
2. Press save... no progress bar  or anything, but using single core 	                                    


Actual Results:
Very slow . There where already perf issues: bug 119075 bug 125619 bug 131675. However it becomes incrementally worse in different area's


Expected Results:
A more snappy experience


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 9c1a48f844eaefc505a5914338b6f444011bf315
CPU threads: 8; OS: macOS 14.3; UI render: Skia/Raster; VCL: osx
Locale: nl-NL (nl_NL.UTF-8); UI: en-US
Calc: threaded
Comment 1 Telesto 2024-06-30 10:28:20 UTC
Possible of relevance https://gerrit.libreoffice.org/c/core/+/162254
Comment 3 Telesto 2024-06-30 12:47:39 UTC
Same on Windows
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: c39e4f6b8a942680bc7250177c34fd034a0605e0
CPU threads: 4; OS: Windows 8.1 X86_64 (6.3 build 9600); UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL threaded
Comment 4 Telesto 2024-06-30 12:52:04 UTC
Saving slow, but faster with 
Version: 7.6.3.0.0+ (X86_64) / LibreOffice Community
Build ID: 35f19e5cb93ce218787904e99c2bedfd40e725cc
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

File open performance is also faster with
Version: 7.6.3.0.0+
Comment 5 Telesto 2024-07-08 11:42:41 UTC
Same effect with attachment 144526 [details] (also comments) when changing sheet order by dragging and dropping
Comment 6 Telesto 2024-07-15 20:24:39 UTC
@Noel
Only for consideration matters after seeing the thread at https://gerrit.libreoffice.org/c/core/+/170496 ("speed up fetching surrogate entries")

I want to point at there might be more perf penalty's with the "surrogate system." 
At least I think so based on my very basic perf profile experience.. 

Note: I'm unable to tell if the surrogate entries as such adding a new layer of issues or simply exposing pre-existing design flaws in this specific case
Comment 7 Stéphane Guillou (stragu) 2024-07-16 03:31:35 UTC
Reproduced in:

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: bbd5079c58e352ece8f10328f8dcda9819c4cfbe
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: CL threaded

Added text in a single cell, saved as with different name, hangs for minutes. I killed it after 5 minutes.
Comment 8 Commit Notification 2024-07-29 08:25:43 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ac41bc3c908c815cf9725b6316d0537d43401ddb

tdf#161846 remove one layout operations (ii)

It will be available in 25.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 9 Commit Notification 2024-07-29 13:10:28 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c39978f41dccbeb2e973c919a67d9b1d974f8f3c

tdf#161846 use unordered_map in SfxItemPropertyMap

It will be available in 25.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 10 Commit Notification 2024-07-29 16:43:54 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/78ff4793f9ad45d84f923686095acb670e7a3ea0

tdf#161846 remove one layout operation (i)

It will be available in 25.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 11 Commit Notification 2024-07-30 05:14:32 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/426adcbadc66fd79859e50ddc0064e899fc019e3

tdf#161846 remove one layout operations (iv)

It will be available in 25.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 12 Commit Notification 2024-07-30 05:14:34 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/510d3585d22d4a6bbaad9832141b5a3005c0c626

tdf#161846 remove one layout operations (iii)

It will be available in 25.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 13 Commit Notification 2024-07-30 08:40:13 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8ab44b114c6706ab2e3d8a19884daeb544d3c2e1

tdf#161846 avoid allocation in ContentNode::Insert

It will be available in 25.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 Commit Notification 2024-07-30 10:30:29 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/24a0ecfc9c8d76dc2af6a44212d5a0a6ed6ffe6b

tdf#161846 reduce re-alloc in ImpEditEngine::GetSelected

It will be available in 25.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 15 Commit Notification 2024-07-30 19:07:27 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

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

tdf#161846 remove one layout operations (v)

It will be available in 25.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 16 Commit Notification 2024-07-31 05:06:39 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/952ded08943731b6e367d7a2b7a54ee7f35464a8

tdf#161846 no need to CloneAsValue() here

It will be available in 25.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 17 Commit Notification 2024-07-31 05:06:41 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/523a46c3a4df0bf9007f1665a115cc33d610bd73

tdf#161846 reduce number of PropertySetInfo objects

It will be available in 25.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 18 Noel Grandin 2024-07-31 05:07:22 UTC
This is now down to < 20s on my machine
Comment 19 Buovjaga 2024-07-31 08:59:05 UTC
UI becomes responsive after 13 secs with the latest commits.

I tried with 25.2 bibisect repo and UI was still unresponsive at 2 min 30 sec when I killed the process.

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 07d357756922e35220a924dab82d315fea22cecb
CPU threads: 8; OS: Linux 6.10; UI render: default; VCL: kf6 (cairo+wayland)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded
Comment 20 Commit Notification 2024-07-31 10:41:24 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8118d1be1be11e8c8c70a0a12da25f0fb3c250f1

tdf#161846 use more GetItemSurrogatesForItem

It will be available in 25.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 21 Commit Notification 2024-07-31 11:58:41 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1a26552de2e692f205695e581166f5eeca67b100

tdf#161846 only need to get the local time once

It will be available in 25.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.