Skip to content

Commit dfc3200

Browse files
committed
Mostly revert "Small performance optimizations."
This reverts commit 1bf5d1c.
1 parent 908a0f5 commit dfc3200

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

include/gtl/phmap.hpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,20 +2489,18 @@ class raw_hash_set {
24892489

24902490
template<class K = key_type>
24912491
bool find_impl(const key_arg<K>& GTL_RESTRICT key, size_t hashval, size_t& GTL_RESTRICT offset) {
2492-
auto ctrl_ptr = ctrl_;
24932492
if constexpr (!std_alloc_t::value) {
24942493
// ctrl_ could be nullptr
2495-
if (!ctrl_ptr)
2494+
if (!ctrl_)
24962495
return false;
24972496
}
24982497
auto seq = probe(hashval);
2499-
auto slots_ptr = slots_;
25002498
while (true) {
2501-
Group g{ ctrl_ptr + seq.offset() };
2499+
Group g{ ctrl_ + seq.offset() };
25022500
for (uint32_t i : g.Match((h2_t)H2(hashval))) {
25032501
offset = seq.offset((size_t)i);
25042502
if (GTL_PREDICT_TRUE(
2505-
PolicyTraits::apply(EqualElement<K>{ key, eq_ref() }, PolicyTraits::element(slots_ptr + offset))))
2503+
PolicyTraits::apply(EqualElement<K>{ key, eq_ref() }, PolicyTraits::element(slots_ + offset))))
25062504
return true;
25072505
}
25082506
if (GTL_PREDICT_TRUE(g.MatchEmpty()))
@@ -2652,11 +2650,9 @@ class raw_hash_set {
26522650
if constexpr (!std::is_trivially_destructible<typename PolicyTraits::value_type>::value ||
26532651
std::is_same<typename Policy::is_flat, std::false_type>::value) {
26542652
// node map or not trivially destructible... we need to iterate and destroy values one by one
2655-
auto slots_ptr = slots_; // local variable not aliased
2656-
auto ctrl_ptr = ctrl_;
26572653
for (size_t i = 0, cnt = capacity_; i != cnt; ++i) {
2658-
if (IsFull(ctrl_ptr[i])) {
2659-
PolicyTraits::destroy(&alloc_ref(), slots_ptr + i);
2654+
if (IsFull(ctrl_[i])) {
2655+
PolicyTraits::destroy(&alloc_ref(), slots_ + i);
26602656
}
26612657
}
26622658
}
@@ -2840,19 +2836,17 @@ class raw_hash_set {
28402836
protected:
28412837
template<class K>
28422838
size_t _find_key(const K& GTL_RESTRICT key, size_t hashval) {
2843-
auto ctrl_ptr = ctrl_;
28442839
if constexpr (!std_alloc_t::value) {
28452840
// ctrl_ could be nullptr
2846-
if (!ctrl_ptr)
2841+
if (!ctrl_)
28472842
return (size_t)-1;
28482843
}
28492844
auto seq = probe(hashval);
2850-
auto slots_ptr = slots_;
28512845
while (true) {
2852-
Group g{ ctrl_ptr + seq.offset() };
2846+
Group g{ ctrl_ + seq.offset() };
28532847
for (uint32_t i : g.Match((h2_t)H2(hashval))) {
28542848
if (GTL_PREDICT_TRUE(PolicyTraits::apply(EqualElement<K>{ key, eq_ref() },
2855-
PolicyTraits::element(slots_ptr + seq.offset((size_t)i)))))
2849+
PolicyTraits::element(slots_ + seq.offset((size_t)i)))))
28562850
return seq.offset((size_t)i);
28572851
}
28582852
if (GTL_PREDICT_TRUE(g.MatchEmpty()))

0 commit comments

Comments
 (0)