Bug 98893 - Remove expensive calls to GetCellType + GetValue/GetString/... in calc
Summary: Remove expensive calls to GetCellType + GetValue/GetString/... in calc
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.2.0
Keywords: difficultyBeginner, easyHack, perf, skillCpp
Depends on:
Blocks:
 
Reported: 2016-03-25 19:53 UTC by Markus Mohrhard
Modified: 2021-02-25 22:46 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Mohrhard 2016-03-25 19:53:59 UTC
In calc we have a common pattern based on the old calc core desing to call:

CellType eType = pDoc->GetCellType(aPos);
switch(eType)
{
    case CELLTYPE_VALUE:
       nVal = pDoc->GetValue(aPos);
    break;
    case CELLTYPE_STRING:
       aStr = pDoc->GetString(aPos);
    break;
    case CELL...
}

which calls two times with a slow call into mdds. Instead we should use ScRefCellValue which only calls once.

The task is to grep for GetCellType in sc/source and find places where we use that pattern and replace it with ScRefCellValue.

Examples for similar problems (not directly the same) are:

https://cgit.freedesktop.org/cgit/?url=libreoffice/core/commit/sc&id=d9c1921c5031e5b372ee9d8db1e00fe7211cdd31
https://cgit.freedesktop.org/cgit/?url=libreoffice/core/commit/sc&id=4518faa31dec03ffabee30437e6960558a940957
https://cgit.freedesktop.org/cgit/?url=libreoffice/core/commit/sc&id=ee98f0e691e3cf945725a9f1daa90542407e3358


Please note that the pDoc->GetString method actually is more complicated than just returning the OUString instances from the ScRefCellValue and you might need to use ScCellFormat::GetString.
Comment 1 Aleksas Pantechovskis 2016-03-26 17:27:46 UTC
I am working on it.
Comment 2 Commit Notification 2016-03-27 22:14:15 UTC
Aleksas Pantechovskis committed a patch related to this issue.
It has been pushed to "master":

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

tdf#98893 Remove expensive calls to GetCellType + GetValue/... in calc

It will be available in 5.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 3 Commit Notification 2016-03-30 04:36:03 UTC
Aleksas Pantechovskis committed a patch related to this issue.
It has been pushed to "master":

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

tdf#98893 Remove expensive calls to GetCellType + GetValue/... in calc

It will be available in 5.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 4 Commit Notification 2016-03-31 19:37:28 UTC
Aleksas Pantechovskis committed a patch related to this issue.
It has been pushed to "master":

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

tdf#98893 Remove expensive calls to GetCellType + GetValue/... in calc

It will be available in 5.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 5 jani 2016-05-02 06:34:48 UTC
A polite ping still working on this patch ?
Comment 6 Aleksas Pantechovskis 2016-05-02 08:42:03 UTC
As far as I remember I fixed all instances of this issue in sc/source.
Comment 7 jani 2016-05-02 09:36:22 UTC
Last comment, makes it seem closed.