Bug 144513 - Perf: editengine hangs for *very* long time in TextEngine::CreateLines when trying to display a long line in a cell
Summary: Perf: editengine hangs for *very* long time in TextEngine::CreateLines when t...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.3.0
Keywords: perf
Depends on:
Blocks:
 
Reported: 2021-09-15 07:25 UTC by Mike Kaganski
Modified: 2021-10-26 16:19 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
A sample file with a query to return a 140000-char string (80.24 KB, application/vnd.sun.xml.base)
2021-09-15 07:25 UTC, Mike Kaganski
Details
perf flamegraph (54.13 KB, application/x-bzip)
2021-09-15 20:30 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2021-09-15 07:25:41 UTC
Created attachment 175026 [details]
A sample file with a query to return a 140000-char string

The attachment is rather a corner case, to demonstrate the problem. It contains a table in Firebird DB with 6-digit integers, and a query to combine them into a single semicolon-delimited 140000-character string. Trying to execute the query performs the SQL instantly, but then hangs ~forever in TextEngine::CreateLines.

(So this is not a Base-related problem; I assume it would hit any such case, and I seem to remember to also see it when testing Calc's cell data limit.)

Noel: possibly you could take a look and apply your magic here? :)
Comment 1 Julien Nabet 2021-09-15 20:30:48 UTC
Created attachment 175038 [details]
perf flamegraph

Here's a Flamegraph retrieved on pc Debian x86-64 with master sources updated today + gen rendering.

BTW, after about 30seconds, the result of query didn't appear (Ryzen 5 2600, 32 GB)
Comment 2 patrick rall 2021-09-19 18:58:45 UTC Comment hidden (spam)
Comment 3 Commit Notification 2021-10-26 16:17:00 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/95cc31f15712bcd2b9829a4f9708374647af6e74

tdf#144513 improve perf when breaking long lines

It will be available in 7.3.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 4 Noel Grandin 2021-10-26 16:19:28 UTC
I have another patch which tries to improve this 
    https://gerrit.libreoffice.org/c/core/+/124212
but that is currently a hack until harfbuzz gains some new API
    https://github.com/harfbuzz/harfbuzz/issues/3265