Bug 43544 - FILEOPEN: Calc extremely slow when opening some XLSX files
Summary: FILEOPEN: Calc extremely slow when opening some XLSX files
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.4.4 release
Hardware: Other All
: medium major
Assignee: Not Assigned
URL:
Whiteboard: BSA target:5.4.0 target:5.3.0.1
Keywords: perf
Depends on:
Blocks:
 
Reported: 2011-12-06 02:28 UTC by synerg.is.tic.folk.sonomy+lo
Modified: 2016-11-28 14:07 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
The 2012 budget book linked here: http://www.kent.edu/budgetoffice/index.cfm (probably generated by Excel 201?) (620.19 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2011-12-06 02:28 UTC, synerg.is.tic.folk.sonomy+lo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description synerg.is.tic.folk.sonomy+lo 2011-12-06 02:28:55 UTC
Created attachment 54142 [details]
The 2012 budget book linked here: http://www.kent.edu/budgetoffice/index.cfm (probably generated by Excel 201?)

Problem description: What the title says.

Steps to reproduce:
1. Open attached file
2. Wait
3. ???
4. Profit!

Current behavior: Libreoffice stalls after drawing a blank gray window and it consume all of one core's cycles. Memory usage is nominal and stable. (82.5MB in my case)
An essentially useless strace shows that it continues to poll for mouse movement.

Expected behavior: File should open and display. All memory and cores should be consumed. 

Platform: Archlinux x64
libreoffice-calc: 3.4.4-3
Comment 1 synerg.is.tic.folk.sonomy+lo 2011-12-06 02:36:19 UTC
Actually, after liboffice runsa at full-tilt for a few minutes (5?), the CPU usage drops to 0. RAM usage is still the same.
I'm not sure what's happening at that point, since I didn't throw an strace on it.
Comment 2 Laurent Godard 2011-12-06 02:42:39 UTC
seems very slow on looping on properties
here is a backtrace

(gdb) bt
#0  0xac9d57b4 in ScAttrArray::FindStyleSheet (this=0x9096110, pStyleSheet=0xa8c68a88, rUsedRows=..., bReset=false)
    at /home/lgodard/projets/libreoffice/build/git/master/libo/sc/source/core/data/attarray.cxx:1723
#1  0xaca07348 in ScColumn::FindStyleSheet (this=0x908b518, pStyleSheet=0xa8c68a88, rUsedRows=..., bReset=false) at /home/lgodard/projets/libreoffice/build/git/master/libo/sc/source/core/data/column.cxx:631
#2  0xacb7fe4a in ScTable::StyleSheetChanged (this=0x9085b90, pStyleSheet=0xa8c68a88, bRemoved=false, pDev=0xbfffbad0, nPPTX=0.067000000000000004, nPPTY=0.067000000000000004, rZoomX=1/1, rZoomY=1/1)
    at /home/lgodard/projets/libreoffice/build/git/master/libo/sc/source/core/data/table2.cxx:2037
#3  0xaca8413c in ScDocument::StyleSheetChanged (this=0x8d64740, pStyleSheet=0xa8c68a88, bRemoved=false, pDev=0xbfffbad0, nPPTX=0.067000000000000004, nPPTY=0.067000000000000004, rZoomX=1/1, rZoomY=1/1)
    at /home/lgodard/projets/libreoffice/build/git/master/libo/sc/source/core/data/document.cxx:4492
#4  0xad1643d7 in ScStyleObj::SetOnePropertyValue (this=0xa8d68ecc, rPropertyName="WritingMode", pEntry=0x8c4c4f0, pValue=0xabaed438)
    at /home/lgodard/projets/libreoffice/build/git/master/libo/sc/source/ui/unoobj/styleuno.cxx:1943
#5  0xad162973 in ScStyleObj::setPropertyValues (this=0xa8d68ecc, aPropertyNames=uno::Sequence of length 39 = {...}, aValues=uno::Sequence of length 39 = {...})
    at /home/lgodard/projets/libreoffice/build/git/master/libo/sc/source/ui/unoobj/styleuno.cxx:1519
#6  0xac061d82 in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#7  0xac061eff in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#8  0xac12ef5c in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#9  0xac12efbd in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#10 0xac12eade in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#11 0xac12f684 in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#12 0xac12fb80 in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#13 0xac1339ee in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#14 0xabdd9438 in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#15 0xabd2b115 in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/fastsax.uno.so
#16 0xabdd08e7 in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#17 0xabdd09ad in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#18 0xabdde416 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&) ()
   from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#19 0xac1410d7 in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#20 0xac13e7a2 in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#21 0xabdd9438 in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#22 0xabd2b115 in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/fastsax.uno.so
#23 0xabdd08e7 in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#24 0xabdd09ad in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#25 0xabdde416 in oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&) ()
   from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#26 0xac0dfbba in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#27 0xabdd404a in oox::core::FilterBase::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) ()
   from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#28 0xac0dfcac in ?? () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libooxlo.so
#29 0xb796d0c8 in SfxObjectShell::ImportFrom(SfxMedium&, bool) () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libsfxlo.so
#30 0xb797436c in SfxObjectShell::DoLoad(SfxMedium*) () from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libsfxlo.so
#31 0xb799625c in SfxBaseModel::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) ()
   from /home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libsfxlo.so
Comment 3 Laurent Godard 2011-12-06 03:11:05 UTC
with profiling help, the offending area

http://opengrok.libreoffice.org/xref/core/sc/source/ui/unoobj/styleuno.cxx#1943
Comment 4 Laurent Godard 2011-12-07 02:43:18 UTC
in the file xl/styles.xml is 4.7 Mb

a lot of styles defined
<numFmts count="7"></numFmts><fonts count="95"></fonts><fills count="58"></fills><borders count="25"></borders><cellStyleXfs count="38064"></cellStyleXfs><cellXfs count="248"></cellXfs><cellStyles count="38064"></cellStyles>
Comment 5 tester8 2012-01-12 06:32:39 UTC
Reproduced with

LOdev 3.5.0beta2 
4ca392c-760cc4d-f39cf3d-1b2857e-60db978
Ubuntu 10.04.3 x86
Linux 2.6.32-37-generic Russian UI

Switch to NEW.
Comment 6 ringe 2013-03-08 19:25:22 UTC
Any reason this is not a duplicate of bug 30770 ?
Comment 7 retired 2014-06-30 08:41:03 UTC
Just FYI: this presists with

LO4.3RC1, OS X 10.9.3
LO4.4a0+, win 8.1
Comment 8 retired 2014-06-30 08:41:50 UTC
Forgot: Excel 2011 on OS X opens this rather fast.
Comment 9 QA Administrators 2015-07-18 17:42:58 UTC Comment hidden (obsolete)
Comment 10 Buovjaga 2015-10-16 20:15:29 UTC
Took a minute to open. Set severity to major due to tediousness.

Win 7 Pro 64-bit Version: 5.1.0.0.alpha1+
Build ID: 186f32f63434e16ff5776251657f902d5808ed3d
TinderBox: Win-x86@39, Branch:master, Time: 2015-10-16_09:42:47
Locale: en-US (fi_FI)
Comment 11 Robinson Tryon (qubit) 2015-12-10 02:02:50 UTC Comment hidden (obsolete)
Comment 12 Maarten Bosmans 2016-09-23 06:14:13 UTC
On Linux with LO 5.2 and git master loading this document only takes a couple of seconds.

Can you verify whether this is also the case with LO 5.2 or a nightly build on Windows?

Although the performance is acceptable now, I still have some ideas of improving it further, but I think the bug can be closed with or without those improvements. (going from 5.5 to 4 seconds is nice to have, but not of major importance)
Comment 13 Buovjaga 2016-09-23 07:29:54 UTC
File opens instantly for me.

Maarten: do you have some commits regarding this report? Just wondering, how we will close this.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.3.0.0.alpha0+
Build ID: cd72269a6a2c85ae9dd4552aa4808ef4fd1f6c0e
CPU Threads: 8; OS Version: Linux 4.7; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on September 21st 2016
Comment 14 Maarten Bosmans 2016-09-23 07:45:39 UTC
Well, I have a work-in-progress patch lying around. I'll finalize it and submit it to gerrit probably somewhere in the next week.

As I said, I think the original very poor is already solved in recent LO, that just needs to be confirmed by the submitter.

But in looking where LO git master spends its time, I encountered some sfxstyle related code with german comments in it saying: "this needs to be optimized". So that's what I'm doing.
Comment 15 Buovjaga 2016-09-23 08:11:46 UTC
Ok, sounds great :)
Closing this as WFM, then.
Comment 16 Commit Notification 2016-11-28 09:41:21 UTC
Maarten Bosmans committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9d99a7b2d1dd973b50a699440ffb69d99d614607

tdf#43544 ScStyleObj: Only call StylePool->find() when necessary

It will be available in 5.4.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.
Comment 17 Commit Notification 2016-11-28 09:43:26 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

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

nitpicks, tdf#43544 follow-up

It will be available in 5.4.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.
Comment 18 Commit Notification 2016-11-28 13:55:16 UTC
Maarten Bosmans committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=852956a271578b9ad7c1ef2983381e109f2a8156&h=libreoffice-5-3

tdf#43544 ScStyleObj: Only call StylePool->find() when necessary

It will be available in 5.3.0.1.

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.
Comment 19 Commit Notification 2016-11-28 13:57:22 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1fe671546218135841d2cb1c99a993b95fd7e12c&h=libreoffice-5-3

nitpicks, tdf#43544 follow-up

It will be available in 5.3.0.1.

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.