Issue 122827

Summary: calc slow saving in xls
Product: Calc Reporter: k.wehrlin
Component: save-exportAssignee: AOO issues mailing list <issues>
Status: CLOSED FIXED QA Contact:
Severity: Critical    
Priority: P3 CC: bob, clarence.guo.bj, concord268, elish, eric.gunderson+apache, fanyuzhen, francis.vaccarella, glb.pubacct, hans-peter, hdu, issues, jgibbons2953, jsc, k.wehrlin, manager, millerb, pescetti, petr.v, pr_lich, reedmace, tom, vondreele
Version: 4.0.0Keywords: performance, regression
Target Milestone: 4.0.1Flags: jsc: 4.0.1_release_blocker+
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
Simple cash accounting spreadsheet
none
XLS format slow saving and memory leak sample document
none
Fix patch hdu: review+, hdu: review?

Description k.wehrlin 2013-07-24 21:00:26 UTC
Created attachment 81137 [details]
Simple cash accounting spreadsheet

Since updating from 3.4.1 to 4.0 saving in xls has increased from less than 2s to more than 20s
File size +- 200k
Machine Dell Optiplex 855
CPU E4500 2.2Ghz
Ram 2Gb
Windows XP Sp3
Comment 1 Edwin Sharp 2013-07-25 05:40:47 UTC
38 seconds to save a change in attachment using Rev. 1505643 Win 7.

Intel i3 2.93 GHz 4 GB RAM
Comment 2 Petr Vones 2013-07-28 14:24:45 UTC
I can confirm that. I looks like a memory leak is also involved. Saving a 77 kB Excel document with 30 simple sheets that sums one colum of ~50 values allocates  1 GB virtual memory. I have killed the soffice process after a minute. Saving the same document takes ~3 sec in OO 3.4.1.

I converted the existing XLS file to ODS format. Saving the ODS document is fast but loading the document is slow, slower than the XLS version. It seems as reverting to OO 3.4.1 is the only solution now.
Comment 3 Petr Vones 2013-07-28 15:55:18 UTC
Created attachment 81182 [details]
XLS format slow saving and memory leak sample document
Comment 4 Petr Vones 2013-07-28 16:01:39 UTC
I have attached another simple XLS document. Steps to reproduce:

1. Start Calc 4.0.0, start Task Manager, select soffice.bin process, watch VM Size column
2. Open the MemoryLeak.xls file in Calc
3. Make a modification to a sheet
4. Save

Watch allocated amount of VM Size, it goes above 300 MB.

5. Close MemoryLeak.xls document
6. Close Calc

Closing soffice.bin process also takes ages and allocated amount of VM Size goes above 600 MB.
Comment 5 pr_lich 2013-07-28 16:41:02 UTC
Going to revert to ver. 3.4.1
Comment 6 k.wehrlin 2013-07-28 18:04:08 UTC
(In reply to Petr Vones from comment #2)
> I can confirm that. I looks like a memory leak is also involved. Saving a 77
> kB Excel document with 30 simple sheets that sums one colum of ~50 values
> allocates  1 GB virtual memory. I have killed the soffice process after a
> minute. Saving the same document takes ~3 sec in OO 3.4.1.
> 
> I converted the existing XLS file to ODS format. Saving the ODS document is
> fast but loading the document is slow, slower than the XLS version. It seems
> as reverting to OO 3.4.1 is the only solution now.

Thanks Petr, I will take your advice and revert to 3.4.1, awaiting the problem in that part of Ver. 4.0 to be solved. It should be possible to pinpoint the routine which does that conversion and best find out what compiler the old routine was compiled with ... I am no programmer, cannot help :-(
Comment 7 k.wehrlin 2013-07-28 18:05:32 UTC
(In reply to pr_lich from comment #5)
> Going to revert to ver. 3.4.1

Agreed ...
Comment 8 Rob Weir 2013-07-29 13:51:25 UTC
Confirmed on Windows 7 64-bit with "simple cash accounting" attachment.

Note:  saving in ODF format is not slow at all, much faster than XLS.   So problem appears to be limited to the XLS writing code.

Raising severity to "critical"
Comment 9 Rob Weir 2013-07-29 14:11:47 UTC
*** Issue 122874 has been marked as a duplicate of this issue. ***
Comment 10 André Bold 2013-07-29 16:30:56 UTC
I am having the same problem, very slow saving........
Comment 11 manager 2013-07-29 18:31:23 UTC
I am having the same problem.  Saving an .xls format worksheet in ver 4 takes more than a minute as it took just seconds in ver 3.  Also I am experiencing display issues.  The screen gets all messed up.  I switch to another tab and then back to the original tab and it looks OK.  As I move around the sheet it gets messed up again.
Comment 12 Ariel Constenla-Haile 2013-07-29 18:38:17 UTC
(In reply to manager from comment #11)
> Also I am
> experiencing display issues.  The screen gets all messed up.  I switch to
> another tab and then back to the original tab and it looks OK.  As I move
> around the sheet it gets messed up again.

this looks like Bug 122801
Comment 13 Ariel Constenla-Haile 2013-07-30 17:33:56 UTC
*** Issue 122896 has been marked as a duplicate of this issue. ***
Comment 14 Petr Vones 2013-07-31 11:33:55 UTC
There seems to be exactly opposite issue when loading documents. The same document is loaded slowly in ODS format but fast in XLS format, see bug 122911
Comment 15 hdu@apache.org 2013-07-31 13:38:15 UTC
FWIW: The oox::xls::CellBlock cache introduced in AOO 3.4 caused some performance problems (bug 119232) that could be related. The fix I suggested (attachment 79789 [details]) was not yet reviewed by the Calc expert though.
Comment 16 Edwin Sharp 2013-08-02 15:05:39 UTC
*** Issue 122941 has been marked as a duplicate of this issue. ***
Comment 17 Gary Bennett 2013-08-05 01:34:34 UTC
If additional confirmation needed:  My win 7 64 system saves an XLS file in version 4 in 13+ seconds.  The same file in ODS saves in less than 3 seconds.  Going the other way, that file opens the XLS version in less than a quarter of a second but takes nearly 2 seconds opening the ODT.

I have not yet reinstalled 3.4, but my recollection is that saving and opening that same file as an XLS were even faster than the best times 4.0 produces, regardless of file type

For my purposes, this bug overshadows the improvements in 4.0.  I must reluctantly go back to last 3.4 version pending a fix.
Comment 18 reedmace 2013-08-05 18:02:22 UTC
Ditto with others. xls spreadsheet used to save in 2 secs in OO 3.4.1. Exactly the same spreadsheet now takes 40 secs in AOO 4.0.

Will be reverting to 3.4.1

Reedmace
Comment 19 hdu@apache.org 2013-08-07 15:35:10 UTC
Reapplying the change of revision 1406980 (for bug 121200) that was undone in revision 1407366 (for bug 119707) gets the performance back to AOO341 levels.

The latter change seems to extend the number of rows visited per sheet
- from 134..217 135 to 65535 for the "Simple cash accounting spreadsheet"
- from 135 to 65535 for the "XLS format slow saving" sample
and that largely expanded range slows things down.
Comment 20 k.wehrlin 2013-08-07 15:49:14 UTC
Great! Sounds good, when can we download the updated Ver.4 ?
Comment 21 Edwin Sharp 2013-08-10 19:12:59 UTC
*** Issue 123000 has been marked as a duplicate of this issue. ***
Comment 22 Edwin Sharp 2013-08-13 06:32:30 UTC
*** Issue 123025 has been marked as a duplicate of this issue. ***
Comment 23 jsc 2013-08-15 08:51:33 UTC
approve as showstopper
Comment 24 Clarence GUO 2013-08-21 03:30:46 UTC
Created attachment 81366 [details]
Fix patch

In fix code of 119707, it needs to calculate the last row with visible attributes in order to avoid missing such rows during XLS exporting. But the mechanism is wrong, it always return 1M row. So redundant information will be stored. That is the root cause.
Symphony doesn't have the problem. So contribute latest symphony code as fix
Comment 25 hdu@apache.org 2013-08-22 14:09:19 UTC
Comment on attachment 81366 [details]
Fix patch

Thanks for the patch! With it the performance is back to normal and first tests show no side-effects. The analysis of the root cause and the fix make very much sense to me. I'm not too proficient in Calc though so I'd like to invite further reviews by developers more familiar with Calc.
Comment 26 hans-peter 2013-08-23 08:50:14 UTC
I downloaded the patch i122827. But now I have a problem: I'm only a "simple user" and I have no clue how to install this patch. Can you give me same help with it?
Comment 27 hdu@apache.org 2013-08-23 10:42:49 UTC
(In reply to hpeter.stuedemann from comment #26)
> I downloaded the patch i122827. But now I have a problem: I'm only a "simple
> user" and I have no clue how to install this patch. Can you give me same
> help with it?

The patch is a source code patch which is intended for a developer audience. As a "simple user" you'll probably want a binary that has the patch applied. When Clarence committed his patch the next pre-release build will contain it. I'll add a link here then. The alternative is to wait for the official Apache OpenOffice 4.0.1 release that will contain the patch too.
Comment 28 SVN Robot 2013-08-28 15:13:05 UTC
"hdu" committed SVN revision 1518253 into trunk:
#i122827# fix the performance regression in xls saving introduced by #i119707#
Comment 29 SVN Robot 2013-08-28 15:14:14 UTC
"hdu" committed SVN revision 1518259 into branches/AOO401:
#i122827# fix the performance regression in xls saving introduced by #i119707#
Comment 30 hdu@apache.org 2013-08-28 15:15:57 UTC
Fixed in trunk and in the AOO401 branch.
Comment 31 fanyuzhen 2013-08-30 03:25:45 UTC
36 seconds to save a change in attachment using Rev. 1516414 Win 7.

Intel i5 2.60 GHz 4 GB RAM
Comment 32 Gary Bennett 2013-08-30 04:10:40 UTC
Still not fixed.  Installed 4.0.1 from snapshot. I see no change in performance.  Takes about 12 seconds to save a spreadsheet that saves in 3.4.1 in about 1 second
Comment 33 hdu@apache.org 2013-08-30 06:55:35 UTC
(In reply to SVN Robot from comment #29)
> "hdu" committed SVN revision 1518259 into branches/AOO401:
> #i122827# fix the performance regression

Only AOO401-snapshots with a revision of 1518259 or higher have the problem fixed.  Older revisions such as 1516414 don't have the fix and without the fix they of course still have the problem. Newer snapshot builds (which contain the fix) will be available soon.
Comment 34 fanyuzhen 2013-08-30 11:25:10 UTC
Thanks for the information, waiting for the build containing the fixe
Comment 35 Gary Bennett 2013-08-30 19:54:12 UTC
This AM installed latest version.  Works as it should.  Thanks to all who contributed to this fix!!
Comment 36 k.wehrlin 2013-08-30 20:00:10 UTC
(In reply to Gary Bennett from comment #35)
> This AM installed latest version.  Works as it should.  Thanks to all who
> contributed to this fix!!

Great! 
Please let us "mere mortals know when the update (with all fixes) is safe to download and what the Rev. Nr must be.

Thanks for great work!
Comment 37 Petr Vones 2013-09-01 19:11:03 UTC
(In reply to k.wehrlin from comment #36)
> Please let us "mere mortals know when the update (with all fixes) is safe to
> download and what the Rev. Nr must be.

Proposed Release Schedule
https://cwiki.apache.org/confluence/display/OOOUSERS/AOO+4.0.1
09/19 GA
Comment 38 k.wehrlin 2013-09-01 20:33:33 UTC
(In reply to Petr Vones from comment #37)
> (In reply to k.wehrlin from comment #36)
> > Please let us "mere mortals know when the update (with all fixes) is safe to
> > download and what the Rev. Nr must be.
> 
> Proposed Release Schedule
> https://cwiki.apache.org/confluence/display/OOOUSERS/AOO+4.0.1
> 09/19 GA

Thanks Petr,

I will be waiting patiently :-)
Comment 39 hdu@apache.org 2013-09-02 08:14:13 UTC
(In reply to k.wehrlin from comment #38)
> I will be waiting patiently :-)

For TESTING only and with the usual caveats ("These builds are intended to be used for early testing by other community volunteers. They have no release quality and should not be installed in a production environment") there is of course the snapshots page at https://cwiki.apache.org/confluence/display/OOOUSERS/Development+Snapshot+Builds which might be interesting...
Comment 40 fanyuzhen 2013-09-05 09:51:44 UTC
It's verified fixed in build AOO401m2(Build:9711)  -  Rev. 1518667
Comment 41 Rob Weir 2013-09-05 11:22:47 UTC
*** Issue 123165 has been marked as a duplicate of this issue. ***
Comment 42 Ariel Constenla-Haile 2013-09-28 23:48:55 UTC
*** Issue 123381 has been marked as a duplicate of this issue. ***
Comment 43 k.wehrlin 2013-11-05 20:22:35 UTC
(In reply to fanyuzhen from comment #40)
> It's verified fixed in build AOO401m2(Build:9711)  -  Rev. 1518667

Haven't had any news for a while, does this mean that I (mere mortal user) may now update to the last version? Would that be 4.1 ?
Comment 44 Andrea Pescetti 2013-11-05 23:42:22 UTC
The problem is fixed in version 4.0.1, available since 1 October 2013 from http://www.openoffice.org/download/
Comment 45 k.wehrlin 2013-11-06 06:39:33 UTC
(In reply to Andrea Pescetti from comment #44)
> The problem is fixed in version 4.0.1, available since 1 October 2013 from
> http://www.openoffice.org/download/

Thanks Andrea,
I downloaded, installed and tried it on the file I found the bug with and so far I am impressed :-)
Thank you all for a job well done!
Comment 46 hdu@apache.org 2013-11-06 07:12:01 UTC
Closing the resolved bug.