Bug 48381 - Pasting a formula in a full column appears to hang Calc
Summary: Pasting a formula in a full column appears to hang Calc
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.5.2 release
Hardware: x86-64 (AMD64) All
: low normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: perf
: 106474 (view as bug list)
Depends on:
Blocks: Paste
  Show dependency treegraph
 
Reported: 2012-04-06 05:15 UTC by clem
Modified: 2021-02-11 08:21 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
testcase for bug 48381 (15.03 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-04-17 09:40 UTC, clem
Details
Mac OS stack trace sample for bug 48381 (642.23 KB, text/plain)
2015-04-17 09:56 UTC, clem
Details

Note You need to log in before you can comment on or make changes to this bug.
Description clem 2012-04-06 05:15:28 UTC
Calculation resulting from pasting a formula in a full column (~ 1M cells) appears to hang the application.

When pasting in very many cells, could the operation be broken in two phases :
- phase one : timing of the processing time to 
resulting first calculation be timed and the whole processing time be extrapolated and eventually result in a special treatment to avoid the hang feeling, whether by having it processed by a different thread or by having a "Cancel/Continue" dialog before the full operation is applied ?

Adding this check should not significantly slow down the most common pastes of 1 to 100 cells.
Comment 1 Nino 2012-04-20 05:53:52 UTC
confirmed in 3.5.2/Linux rpm/32.
Comment 2 steve 2015-04-17 07:47:27 UTC
Clement, does this persist with LO 4.4?

What are the exact steps to reproduce this problem? NEEDINFO and please back to NEW once the requested information has been provided.
Comment 3 clem 2015-04-17 09:40:34 UTC
Created attachment 114852 [details]
testcase for bug 48381

An ODS document with 2 sheets :
 one is "invoice" with columns (invoice_id, client_id, invoice_amount)
 two is "client" with columns (client_id, total_invoiced)

There are 100 invoice rows and 300 client rows both filled with random generated test data.

Where the formula in client.B2 is : 
=somme.si(invoice.B$2:B$1000; A2 ; invoice.C$2:C$1000)
(which function would likely be SUM.IF in english)
Comment 4 clem 2015-04-17 09:56:27 UTC
Created attachment 114853 [details]
Mac OS stack trace sample for bug 48381

Output of the Apple /usr/bin/sample analysis tool showing 3 seconds of sampling every 1ms entirely within the duration of the hung interface.

The interesting parts are where the statistics of where the program spends most of it's time are supplied : search for these :
- Total number in stack
- Sort by top of stack
Comment 5 clem 2015-04-17 10:06:09 UTC
To reproduce :

- open testcase
- select client.B2
- Copy
- select client.B (whole column)
- remove client.B1 (column title) from selection
- paste

Saving the resulting file is equally long.

This teaches me that pasting complicated formulae into 1 million cells could have you wait a little time.

However, LibreOffice aiming to be a trouble free experience for it's users might want to deal with long calculations in an appropriate manner that lets the user know what happens and eventually cancel the process if it takes too long.

In that instance, there are no need to calculate 1M cells, just 300, and that is done in a snap.
Comment 6 clem 2015-04-17 10:11:47 UTC
And yes, it persists in 4.4.

I have reproduced them today 2015-04-17 in Version: 4.4.1.2
Build ID: 45e2de17089c24a1fa810c8f975a7171ba4cd432
Locale : fr_

I hope it helps. I have software development training but no practice in 20 years, if there is anything I can do more, i'd be willing to help but i'm a bit scared to dive in LO code and mess things around !

On Mac intel 64b / Yosemite / Xcode installed
Comment 7 David Fischer 2015-08-22 13:16:46 UTC
It took me ~20 seconds to paste =TODAY() into an entire column.  I am not sure this should be unexpected, Calc is pasting and evaluating 1,048,576 rows.  Does Microsoft Excel have this problem?

LO: 5.0.0.5
OS: Linux Mint 17.2
Comment 8 Buovjaga 2017-04-28 05:19:11 UTC
*** Bug 106474 has been marked as a duplicate of this bug. ***
Comment 9 Buovjaga 2021-02-11 08:21:31 UTC
The pasting is rather quick now, so I will close this.