[Libreoffice-bugs] [Bug 144777] countifs() in Calc is slower than Excel's countifs()
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Thu Sep 30 19:00:03 UTC 2021
https://bugs.documentfoundation.org/show_bug.cgi?id=144777
Julien Nabet <serval2412 at yahoo.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |erack at redhat.com,
| |noelgrandin at gmail.com
--- Comment #13 from Julien Nabet <serval2412 at yahoo.fr> ---
Eike/Noel: the Flamegraph shows that a lot of time is in ScTable::ValidQuery
See
https://opengrok.libreoffice.org/xref/core/sc/source/core/data/table3.cxx?r=b60b6bfa#2979
I noticed in the loop "for (const auto& rItem : rItems)" at line 3039 that
perhaps changing the order of test may help.
For example, I thought about putting:
3069 else if (rParam.mbRangeLookup)
3070 {
3071 std::pair<bool,bool> aThisRes =
3072 aEval.compareByRangeLookup(aCell, nCol, nRow,
rEntry, rItem);
3073 aRes.first |= aThisRes.first;
3074 aRes.second |= aThisRes.second;
3075 }
3076
3077 if (aRes.first && aRes.second)
3078 break;
just after:
3041 if (rItem.meType == ScQueryEntry::ByTextColor)
3042 {
3043 std::pair<bool, bool> aThisRes
3044 = aEval.compareByTextColor(nCol, nRow, nTab,
rItem);
3045 aRes.first |= aThisRes.first;
3046 aRes.second |= aThisRes.second;
3047 }
3048 else if (rItem.meType == ScQueryEntry::ByBackgroundColor)
3049 {
3050 std::pair<bool,bool> aThisRes =
3051 aEval.compareByBackgroundColor(nCol, nRow, nTab,
rItem);
3052 aRes.first |= aThisRes.first;
3053 aRes.second |= aThisRes.second;
3054 }
so these would be at the end:
3055 else if (aEval.isQueryByValue(rItem, nCol, nRow, aCell))
3056 {
3057 std::pair<bool,bool> aThisRes =
3058 aEval.compareByValue(aCell, nCol, nRow, rEntry,
rItem, pContext);
3059 aRes.first |= aThisRes.first;
3060 aRes.second |= aThisRes.second;
3061 }
3062 else if (aEval.isQueryByString(rEntry, rItem, nCol, nRow,
aCell))
3063 {
3064 std::pair<bool,bool> aThisRes =
3065 aEval.compareByString(aCell, nRow, rEntry, rItem,
pContext);
3066 aRes.first |= aThisRes.first;
3067 aRes.second |= aThisRes.second;
3068 }
So we would call "isQueryByValue" and/or "isQueryByString" only if necessary.
Now, I don't know if the order of evaluation matters and could change the final
result.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210930/d713090d/attachment.htm>
More information about the Libreoffice-bugs
mailing list