Bug 90199 - remove a lot of sheets is slow
Summary: remove a lot of sheets is slow
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: Other All
: medium normal
Assignee: Noel Grandin
URL:
Whiteboard: target:5.2.0
Keywords: bibisectRequest, perf, regression
Depends on:
Blocks:
 
Reported: 2015-03-24 15:28 UTC by Laurent Godard
Modified: 2016-10-25 19:12 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
sample document with macro to reproduce - hit the Go ! button (1.39 MB, application/vnd.oasis.opendocument.spreadsheet)
2015-03-24 15:28 UTC, Laurent Godard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Godard 2015-03-24 15:28:13 UTC
Created attachment 114306 [details]
sample document with macro to reproduce - hit the Go ! button

* use case
a big file with 500 sheets and formulas
in a macro, removing 250 sheets

it takes around 330 seconds
Comment 1 Laurent Godard 2015-03-24 15:34:50 UTC
callgrind stuff (13 Mb) available at
http://oooconv.free.fr/tests/bug90199/callgrind.removeSheets.tar.gz

have a look at callgrind.out.2686.3
ScDocument::DeleteTab
Comment 2 Laurent Godard 2015-03-24 15:52:30 UTC
update 
callgrind.out.2686.3 is partial, only for 227 tab deletion but shows the involved areas
Comment 3 Buovjaga 2015-03-25 19:15:07 UTC
56,769 seconds on a Lenovo T520 from 2012 Dec.

Win 7 Pro 64-bit, LibO Version: 4.4.1.2
Build ID: 45e2de17089c24a1fa810c8f975a7171ba4cd432
Locale: fi_FI
Comment 4 Robinson Tryon (qubit) 2015-04-17 21:24:53 UTC
(In reply to Beluga from comment #3)
> 56,769 seconds on a Lenovo T520 from 2012 Dec.

So what are we thinking here? Is this a perf issue, or just a large task that takes a long time?

Is the performance any better with older versions of LibreOffice? (e.g. is this a regression?)

Status -> NEEDINFO
Comment 5 Buovjaga 2015-04-18 06:40:46 UTC
3.3.0 could not open fully, because number of sheets was exceeded.

3.6.7 completes in 33.666 seconds and this is in an Ubuntu virtual machine, so it seems we have a performance regression in our hands.

4.4.2 on the same Ubuntu VM takes 79.017 seconds.

Ubuntu 14.10 64-bit 
Version: 4.4.2.2
Build ID: 40m0(Build:2)
Locale: en_US

Version 3.6.7.2 (Build ID: e183d5b)
Comment 6 raal 2015-12-04 16:09:19 UTC
reproducible with Version: 4.2.0.0.alpha1+
Comment 7 Robinson Tryon (qubit) 2015-12-09 17:54:21 UTC Comment hidden (obsolete)
Comment 8 Commit Notification 2015-12-18 08:54:51 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=60e67b387e79185a33eb07bc03b01cd6d0d0a56b

fix O(n^2) in vcl event broadcasting tdf#90199

It will be available in 5.2.0.

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

Affected users are encouraged to test the fix and report feedback.