sc/inc/lookupcache.hxx | 3 ++- sc/source/core/tool/lookupcache.cxx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
New commits: commit 9cc43189ecc9720e3e88175c2a06affa44d3d40a Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sat Jan 25 20:20:52 2025 +0000 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Jan 28 10:51:16 2025 +0100 Resolves: tdf#164853 find_if causing copy the pred param of: const std::pair<QueryKey, QueryCriteriaAndResult>& doesn't exactly match what the arg should be, which is const std::pair<const QueryKey, QueryCriteriaAndResult>& so an unecessary copy is silently created, add and use some typedefs to make this more straightforward. seen with: perf record -e mem_load_l3_hit_retired.xsnp_fwd -e mem_load_l3_hit_retired.xsnp_miss on profiling specifically for contested accesses, see tma_contested_accesses in perf -v Change-Id: I1d1a57e49a0f2af8bc57ca22ac4572c0246c719b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180754 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sc/inc/lookupcache.hxx b/sc/inc/lookupcache.hxx index ca1d333880fa..2f39192149fc 100644 --- a/sc/inc/lookupcache.hxx +++ b/sc/inc/lookupcache.hxx @@ -189,7 +189,8 @@ private: } }; - std::unordered_map< QueryKey, QueryCriteriaAndResult, QueryKey::Hash > maQueryMap; + typedef std::unordered_map<QueryKey, QueryCriteriaAndResult, QueryKey::Hash> QueryMap; + QueryMap maQueryMap; ScRange maRange; ScDocument * mpDoc; ScLookupCacheMap & mCacheMap; diff --git a/sc/source/core/tool/lookupcache.cxx b/sc/source/core/tool/lookupcache.cxx index 70e19ec20d86..24f5acf6abbb 100644 --- a/sc/source/core/tool/lookupcache.cxx +++ b/sc/source/core/tool/lookupcache.cxx @@ -88,7 +88,7 @@ SCROW ScLookupCache::lookup( const QueryCriteria & rCriteria ) const { // try to find the row index for which we have already performed lookup auto it = std::find_if(maQueryMap.begin(), maQueryMap.end(), - [&rCriteria](const std::pair<QueryKey, QueryCriteriaAndResult>& rEntry) { + [&rCriteria](const QueryMap::value_type& rEntry) { return rEntry.second.maCriteria == rCriteria; }); if (it != maQueryMap.end())