Skip to content

Commit 154c634

Browse files
committed
Mostly revert "Small performance optimizations."
1 parent 2b6ef17 commit 154c634

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

parallel_hashmap/phmap.h

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,21 +1858,19 @@ class raw_hash_set
18581858

18591859
template <class K = key_type>
18601860
bool find_impl(const key_arg<K>& PHMAP_RESTRICT key, size_t hashval, size_t& PHMAP_RESTRICT offset) {
1861-
auto ctrl_ptr = ctrl_;
18621861
PHMAP_IF_CONSTEXPR (!std_alloc_t::value) {
18631862
// ctrl_ could be nullptr
1864-
if (!ctrl_ptr)
1863+
if (!ctrl_)
18651864
return false;
18661865
}
18671866
auto seq = probe(hashval);
1868-
auto slots_ptr = slots_;
18691867
while (true) {
1870-
Group g{ ctrl_ptr + seq.offset() };
1868+
Group g{ ctrl_ + seq.offset() };
18711869
for (uint32_t i : g.Match((h2_t)H2(hashval))) {
18721870
offset = seq.offset((size_t)i);
18731871
if (PHMAP_PREDICT_TRUE(PolicyTraits::apply(
18741872
EqualElement<K>{key, eq_ref()},
1875-
PolicyTraits::element(slots_ptr + offset))))
1873+
PolicyTraits::element(slots_ + offset))))
18761874
return true;
18771875
}
18781876
if (PHMAP_PREDICT_TRUE(g.MatchEmpty()))
@@ -2036,11 +2034,9 @@ class raw_hash_set
20362034
std::is_same<typename Policy::is_flat, std::false_type>::value)) {
20372035
// node map, or not trivially destructible... we need to iterate and destroy values one by one
20382036
// std::cout << "either this is a node map or " << type_name<typename PolicyTraits::value_type>() << " is not trivially_destructible\n";
2039-
auto slots_ptr = slots_;
2040-
auto ctrl_ptr = ctrl_;
20412037
for (size_t i = 0, cnt = capacity_; i != cnt; ++i) {
2042-
if (IsFull(ctrl_ptr[i])) {
2043-
PolicyTraits::destroy(&alloc_ref(), slots_ptr + i);
2038+
if (IsFull(ctrl_[i])) {
2039+
PolicyTraits::destroy(&alloc_ref(), slots_ + i);
20442040
}
20452041
}
20462042
}
@@ -2225,20 +2221,18 @@ class raw_hash_set
22252221
protected:
22262222
template <class K>
22272223
size_t _find_key(const K& PHMAP_RESTRICT key, size_t hashval) {
2228-
auto ctrl_ptr = ctrl_;
22292224
PHMAP_IF_CONSTEXPR (!std_alloc_t::value) {
22302225
// ctrl_ could be nullptr
2231-
if (!ctrl_ptr)
2226+
if (!ctrl_)
22322227
return (size_t)-1;
22332228
}
22342229
auto seq = probe(hashval);
2235-
auto slots_ptr = slots_;
22362230
while (true) {
2237-
Group g{ctrl_ptr + seq.offset()};
2231+
Group g{ctrl_ + seq.offset()};
22382232
for (uint32_t i : g.Match((h2_t)H2(hashval))) {
22392233
if (PHMAP_PREDICT_TRUE(PolicyTraits::apply(
22402234
EqualElement<K>{key, eq_ref()},
2241-
PolicyTraits::element(slots_ptr + seq.offset((size_t)i)))))
2235+
PolicyTraits::element(slots_ + seq.offset((size_t)i)))))
22422236
return seq.offset((size_t)i);
22432237
}
22442238
if (PHMAP_PREDICT_TRUE(g.MatchEmpty())) break;

0 commit comments

Comments
 (0)