diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2016-02-16 07:07:53 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-02-16 09:08:59 +0000 |
commit | f18cb2c196cc5b643b9832dfca1d940b82c832b0 (patch) | |
tree | b6e26cdd49814ea4d598b8ae8c5999db9e09f036 /sc/source/ui/docshell | |
parent | fe90ba29ad7345037e3707916b2696010213bda6 (diff) |
single element access is really slow in mdds, tdf#67071
Change-Id: I5491ba0bc44a9ce8844b31126835671c5d5abcaa
Reviewed-on: https://gerrit.libreoffice.org/22386
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r-- | sc/source/ui/docshell/externalrefmgr.cxx | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 699ac2793488..7bbf7b728529 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -791,35 +791,21 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa pTabData.reset(new Table); const ScMatrixRef& pMat = itrData->mpRangeData; - for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow) + ScFullMatrix::DoubleOpFunction aDoubleFunc = [=](size_t row, size_t col, double val) -> void { - const SCSIZE nR = nRow - nRow1; - for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) - { - const SCSIZE nC = nCol - nCol1; - - ScMatrixValue value = pMat->Get(nC, nR); - - TokenRef pToken; - - switch (value.nType) { - case SC_MATVAL_VALUE: - case SC_MATVAL_BOOLEAN: - pToken.reset(new formula::FormulaDoubleToken(value.fVal)); - break; - case SC_MATVAL_STRING: - pToken.reset(new formula::FormulaStringToken(value.aStr)); - break; - default: - // Don't cache empty cells. - break; - } - - if (pToken) - // Don't mark this cell 'cached' here, for better performance. - pTabData->setCell(nCol, nRow, pToken, 0, false); - } - } + pTabData->setCell(col + nCol1, row + nRow1, new formula::FormulaDoubleToken(val), 0, false); + }; + ScFullMatrix::BoolOpFunction aBoolFunc = [=](size_t row, size_t col, bool val) -> void + { + pTabData->setCell(col + nCol1, row + nRow1, new formula::FormulaDoubleToken(val), 0, false); + }; + ScFullMatrix::StringOpFunction aStringFunc = [=](size_t row, size_t col, svl::SharedString val) -> void + { + pTabData->setCell(col + nCol1, row + nRow1, new formula::FormulaStringToken(val), 0, false); + }; + pMat->ExecuteOperation(std::pair<size_t, size_t>(0, 0), + std::pair<size_t, size_t>(nRow2-nRow1, nCol2-nCol1), + aDoubleFunc, aBoolFunc, aStringFunc); // Mark the whole range 'cached'. pTabData->setCachedCellRange(nCol1, nRow1, nCol2, nRow2); } |