sc/inc/lookupcache.hxx              |    3 ++-
 sc/source/core/tool/lookupcache.cxx |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit c45954219b6f86382fc1945df011810f6b7dd035
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat Jan 25 20:20:52 2025 +0000
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Mon Jan 27 08:50:22 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/+/180756
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/sc/inc/lookupcache.hxx b/sc/inc/lookupcache.hxx
index 00194ebd162c..bc50045f06a8 100644
--- a/sc/inc/lookupcache.hxx
+++ b/sc/inc/lookupcache.hxx
@@ -203,7 +203,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 d4c19a3c7e07..c405714f1e34 100644
--- a/sc/source/core/tool/lookupcache.cxx
+++ b/sc/source/core/tool/lookupcache.cxx
@@ -89,7 +89,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())

Reply via email to