From 1a32af4192291ea5cfe7c4c143144a5dab1f156e Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Mon, 22 Nov 2021 13:16:43 +0100 Subject: cache error strings for ScTable::validQuery() (tdf#133835) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid calling SharedStringPool::intern() on values that are repeatedly the same. Change-Id: I094f2e777a4ca24536e0c25e6a1c6358ccf49f61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125660 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- sc/inc/table.hxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sc/inc/table.hxx') diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 40806e70f31a..332be67ee551 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -954,10 +954,17 @@ public: void Reorder( const sc::ReorderParam& rParam ); + // Internal cache that can be repeatedly used for a sequence of related ValidQuery() + // calls (related meaning done in a loop for the same document and query data). + struct ValidQueryCache + { + std::unordered_map mCachedSharedErrorStrings; + }; bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, const ScRefCellValue* pCell = nullptr, bool* pbTestEqualCondition = nullptr, const ScInterpreterContext* pContext = nullptr, - sc::TableColumnBlockPositionSet* pBlockPos = nullptr ); + sc::TableColumnBlockPositionSet* pBlockPos = nullptr, + ValidQueryCache* pQueryCache = nullptr ); void TopTenQuery( ScQueryParam& ); void PrepareQuery( ScQueryParam& rQueryParam ); SCSIZE Query(const ScQueryParam& rQueryParam, bool bKeepSub); -- cgit