mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-29 16:40:39 +08:00
Add prefetch_hash for parrallel hash map/set
This commit is contained in:
Vendored
+6
-4
@@ -3206,16 +3206,18 @@ public:
|
||||
// NOTE: This is a very low level operation and should not be used without
|
||||
// specific benchmarks indicating its importance.
|
||||
// --------------------------------------------------------------------
|
||||
template <class K = key_type>
|
||||
void prefetch(const key_arg<K>& key) const {
|
||||
(void)key;
|
||||
size_t hashval = this->hash(key);
|
||||
void prefetch_hash(size_t hashval) const {
|
||||
const Inner& inner = sets_[subidx(hashval)];
|
||||
const auto& set = inner.set_;
|
||||
typename Lockable::SharedLock m(const_cast<Inner&>(inner));
|
||||
set.prefetch_hash(hashval);
|
||||
}
|
||||
|
||||
template <class K = key_type>
|
||||
void prefetch(const key_arg<K>& key) const {
|
||||
prefetch_hash(this->hash(key));
|
||||
}
|
||||
|
||||
// The API of find() has two extensions.
|
||||
//
|
||||
// 1. The hash can be passed by the user. It must be equal to the hash of the
|
||||
|
||||
Reference in New Issue
Block a user