diff options
author | Eike Rathke <erack@redhat.com> | 2018-11-22 21:37:52 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-11-23 12:31:51 +0100 |
commit | 0c8b936734285ee7f373c41ecbad5a65953789dc (patch) | |
tree | 2a10e366739aaef7ece855315c74575be91b097c /sc | |
parent | 01e479272ae419384d2fa088370b52fc7160709f (diff) |
Check isEmptyStringQuery() early to avoid call ..., tdf#121052 follow-up
... and comparison of lcl_getPrevRowWithEmptyValueLookup() result.
Change-Id: Ie4b848f30a0696cc40b04376c352a530b99190b9
Reviewed-on: https://gerrit.libreoffice.org/63840
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index b1bca830b582..c659f0f93ae3 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -9769,9 +9769,10 @@ static bool lcl_LookupQuery( ScAddress & o_rResultPos, ScDocument * pDoc, const // [RangeArray] is the reference, which is to comprise at least two columns. // [Index] is the number of the column in the array that contains the value to be returned. The first column has the number 1. // +// Prerequisite of lcl_getPrevRowWithEmptyValueLookup(): +// Value referenced by [SearchCriterion] is empty. // lcl_getPrevRowWithEmptyValueLookup() performs following checks: -// - if value referenced by [SearchCriterion] is empty -// - and if we run query with "exact match" mode (i.e. VLOOKUP) +// - if we run query with "exact match" mode (i.e. VLOOKUP) // - and if we already have the same lookup done before but for another row // which is also had empty [SearchCriterion] // @@ -9786,12 +9787,9 @@ static bool lcl_LookupQuery( ScAddress & o_rResultPos, ScDocument * pDoc, const // This method was added only for speed up to avoid several useless complete // lookups inside [RangeArray] for searching empty strings. // -static SCROW lcl_getPrevRowWithEmptyValueLookup(const ScLookupCache& rCache, const ScLookupCache::QueryCriteria& aCriteria, const ScQueryParam & rParam) +static SCROW lcl_getPrevRowWithEmptyValueLookup( const ScLookupCache& rCache, + const ScLookupCache::QueryCriteria& rCriteria, const ScQueryParam & rParam) { - // is search with equal match? - if (! aCriteria.isEmptyStringQuery()) - return -1; // not found - // is lookup value empty? const ScQueryEntry& rEntry = rParam.GetEntry(0); const ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); @@ -9800,7 +9798,7 @@ static SCROW lcl_getPrevRowWithEmptyValueLookup(const ScLookupCache& rCache, con // try to find the row index for which we have already performed lookup // and have some result of it inside cache - return rCache.lookup( aCriteria ); + return rCache.lookup( rCriteria ); } bool ScInterpreter::LookupQueryWithCache( ScAddress & o_rResultPos, @@ -9830,7 +9828,7 @@ bool ScInterpreter::LookupQueryWithCache( ScAddress & o_rResultPos, // tdf#121052: Slow load of cells with VLOOKUP with references to empty cells // This check was added only for speed up to avoid several useless complete // lookups inside [RangeArray] for searching empty strings. - if (eCacheResult == ScLookupCache::NOT_CACHED) + if (eCacheResult == ScLookupCache::NOT_CACHED && aCriteria.isEmptyStringQuery()) { const SCROW nPrevRowWithEmptyValueLookup = lcl_getPrevRowWithEmptyValueLookup(rCache, aCriteria, rParam); if (nPrevRowWithEmptyValueLookup >= 0) |