Bug 119820 - Fileopen ODT: Slow file opening (since 6.2)
Summary: Fileopen ODT: Slow file opening (since 6.2)
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.2.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:6.2.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2018-09-12 11:26 UTC by Telesto
Modified: 2019-08-09 07:18 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (21.45 KB, application/vnd.oasis.opendocument.text)
2018-09-12 11:34 UTC, Telesto
Details
Bibisect log (2.76 KB, text/plain)
2018-09-12 11:35 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2018-09-12 11:26:44 UTC
Description:
Fileopen ODT: Slow file opening (since 6.2)

Steps to Reproduce:
1. Open the attached file


Actual Results:
10 seconds unresponsive

Expected Results:
2 seconds


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.2.0.0.alpha0+
Build ID: d5a2202f955657e427670a87c2d4e5638884517b
CPU threads: 4; OS: Windows 6.3; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-09-12_02:38:23
Locale: en-US (nl_NL); Calc: CL
Comment 1 Telesto 2018-09-12 11:34:11 UTC
Created attachment 144815 [details]
Example file
Comment 2 Telesto 2018-09-12 11:35:13 UTC
Created attachment 144816 [details]
Bibisect log

Bisected to
author	Miklos Vajna <vmiklos@collabora.co.uk>	2018-08-31 18:19:12 +0200
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2018-09-03 09:13:32 +0200
commit aeff83240c88435d11590f5e9c6fe9927a508c6a (patch)
tree a3b918a7d3164ee428a4df39df7118a87618dfd9
parent 08b5048198d59441cb8033ed14cd17e68c943004 (diff)
sw: save more vcl layout calls in SwFntObj
This builds on top of commit 436b829f5b904d76039db0818cff5dedf1ae89f1
(sw: save one vcl layout call in SwFntObj::DrawText(), 2018-08-16), but
now layouts are shared not only inside SwFntObj::DrawText(), but also
between SwFntObj::GetTextSize() and SwFntObj::DrawText().

To get there, create an SwFntObj cache member that stores already
calculated vcl layouts. SwFntObj already derives from SwCacheObj, so no
need to explicitly expire this cache member.

Total number of GenericSalLayout::LayoutText() invocations go down from
8 to 5 with this when pressing a key in Writer.
Comment 3 Telesto 2018-09-12 11:39:18 UTC
Scrolling performance regressed to.
Comment 4 Xisco Faulí 2018-09-12 14:30:27 UTC
So, it seems the performance regression at import time has been introduced in two different commits.

it changed from 

real	0m6.311s
user	0m5.801s
sys	0m0.422s

to

real	0m10.751s
user	0m10.275s
sys	0m0.402s

in https://cgit.freedesktop.org/libreoffice/core/commit/?id=aeff83240c88435d11590f5e9c6fe9927a508c6a

and later to

real	0m19.050s
user	0m18.575s
sys	0m0.325s

in https://cgit.freedesktop.org/libreoffice/core/commit/?id=2a73c9e04ba9379c0561a7e8d531b5633c46ec52

use time OOO_EXIT_POST_STARTUP=1 for the measuring 

Adding Cc: to Miklos Vajna
Comment 5 Miklos Vajna 2018-09-17 12:41:16 UTC
Thanks for the quick feedback!
Comment 6 Commit Notification 2018-09-17 20:45:03 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

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

tdf#119820 sw: optimize SwTextGlyphsKey comparison

It will be available in 6.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.
Comment 7 Xisco Faulí 2018-09-19 10:50:36 UTC
Opening time back to normal

real	0m7.111s
user	0m6.813s
sys	0m0.248s

in

Version: 6.2.0.0.alpha0+
Build ID: 47a173edb603538521a035157efb6ef684238087
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: threaded

@Miklos, Thanks for the quick fix!