diff --git a/include/boost/unordered/concurrent_flat_map.hpp b/include/boost/unordered/concurrent_flat_map.hpp index 2f1bd43c..0318535d 100644 --- a/include/boost/unordered/concurrent_flat_map.hpp +++ b/include/boost/unordered/concurrent_flat_map.hpp @@ -252,6 +252,14 @@ namespace boost { return table_.bulk_visit(keys, f); } + template + BOOST_FORCEINLINE + std::size_t bulk_visit2(const std::array& keys,F f)const + { + BOOST_UNORDERED_STATIC_ASSERT_CONST_INVOCABLE(F) + return table_.bulk_visit2(keys, f); + } + template BOOST_FORCEINLINE typename std::enable_if< detail::are_transparent::value, size_type>::type diff --git a/include/boost/unordered/detail/foa/concurrent_table.hpp b/include/boost/unordered/detail/foa/concurrent_table.hpp index 82c4e136..34b0e6dc 100644 --- a/include/boost/unordered/detail/foa/concurrent_table.hpp +++ b/include/boost/unordered/detail/foa/concurrent_table.hpp @@ -565,7 +565,6 @@ public: return visit(x,std::forward(f)); } -#if 1 template BOOST_FORCEINLINE std::size_t bulk_visit(const std::array& keys,F&& f)const @@ -635,30 +634,30 @@ public: } return res; } -#else + template BOOST_FORCEINLINE - std::size_t bulk_visit(const std::array& keys,F&& f)const + std::size_t bulk_visit2(const std::array& keys,F&& f)const { auto lck=shared_access(); std::size_t res=0, - hashes[M]; + hashes[M], + positions[M]; for(std::size_t i=0;ihash_for(keys[i]); - auto pos=this->position_for(hashes[i]); - BOOST_UNORDERED_PREFETCH(this->arrays.groups+pos); - BOOST_UNORDERED_PREFETCH(this->arrays.group_accesses+pos); - BOOST_UNORDERED_PREFETCH_ELEMENTS(this->arrays.elements+pos*N,N); + auto pos=positions[i]=this->position_for(hashes[i]); + BOOST_UNORDERED_PREFETCH(this->arrays.groups()+pos); + BOOST_UNORDERED_PREFETCH(this->arrays.group_accesses()+pos); + BOOST_UNORDERED_PREFETCH_ELEMENTS(this->arrays.elements()+pos*N,N); } for(std::size_t i=0;iposition_for(hashes[i]),hashes[i], + group_shared{},keys[i],positions[i],hashes[i], std::forward(f)); } return res; } -#endif template std::size_t visit_all(F&& f) {