Skip to content

Commit a5e3599

Browse files
ckennellycopybara-github
authored andcommitted
Revert: Add an attribute to HashtablezInfo which performs a bitwise XOR on all hashes. The purposes of this attribute is to identify if identical hash tables are being created. If we see a large number of identical tables, it's likely the code can be improved by using a common table as opposed to keep rebuilding the same one.
PiperOrigin-RevId: 833973687 Change-Id: I71e7750f07ec04d97b0a63a76741eecbf1641624
1 parent 31ef391 commit a5e3599

File tree

5 files changed

+0
-18
lines changed

5 files changed

+0
-18
lines changed

absl/container/internal/hashtablez_sampler.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ void HashtablezInfo::PrepareForSampling(int64_t stride,
8787
total_probe_length.store(0, std::memory_order_relaxed);
8888
hashes_bitwise_or.store(0, std::memory_order_relaxed);
8989
hashes_bitwise_and.store(~size_t{}, std::memory_order_relaxed);
90-
hashes_bitwise_xor.store(0, std::memory_order_relaxed);
9190
max_reserve.store(0, std::memory_order_relaxed);
9291

9392
create_time = absl::Now();
@@ -244,7 +243,6 @@ void RecordInsertMissSlow(HashtablezInfo* info, size_t hash,
244243

245244
info->hashes_bitwise_and.fetch_and(hash, std::memory_order_relaxed);
246245
info->hashes_bitwise_or.fetch_or(hash, std::memory_order_relaxed);
247-
info->hashes_bitwise_xor.fetch_xor(hash, std::memory_order_relaxed);
248246
info->max_probe_length.store(
249247
std::max(info->max_probe_length.load(std::memory_order_relaxed),
250248
probe_length),

absl/container/internal/hashtablez_sampler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ struct HashtablezInfo : public profiling_internal::Sample<HashtablezInfo> {
8888
std::atomic<size_t> total_probe_length;
8989
std::atomic<size_t> hashes_bitwise_or;
9090
std::atomic<size_t> hashes_bitwise_and;
91-
std::atomic<size_t> hashes_bitwise_xor;
9291
std::atomic<size_t> max_reserve;
9392

9493
// All of the fields below are set by `PrepareForSampling`, they must not be

absl/container/internal/hashtablez_sampler_test.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ TEST(HashtablezInfoTest, PrepareForSampling) {
105105
EXPECT_EQ(info.total_probe_length.load(), 0);
106106
EXPECT_EQ(info.hashes_bitwise_or.load(), 0);
107107
EXPECT_EQ(info.hashes_bitwise_and.load(), ~size_t{});
108-
EXPECT_EQ(info.hashes_bitwise_xor.load(), 0);
109108
EXPECT_EQ(info.max_reserve.load(), 0);
110109
EXPECT_GE(info.create_time, test_start);
111110
EXPECT_EQ(info.weight, test_stride);
@@ -122,7 +121,6 @@ TEST(HashtablezInfoTest, PrepareForSampling) {
122121
info.total_probe_length.store(1, std::memory_order_relaxed);
123122
info.hashes_bitwise_or.store(1, std::memory_order_relaxed);
124123
info.hashes_bitwise_and.store(1, std::memory_order_relaxed);
125-
info.hashes_bitwise_xor.store(1, std::memory_order_relaxed);
126124
info.max_reserve.store(1, std::memory_order_relaxed);
127125
info.create_time = test_start - absl::Hours(20);
128126

@@ -139,7 +137,6 @@ TEST(HashtablezInfoTest, PrepareForSampling) {
139137
EXPECT_EQ(info.total_probe_length.load(), 0);
140138
EXPECT_EQ(info.hashes_bitwise_or.load(), 0);
141139
EXPECT_EQ(info.hashes_bitwise_and.load(), ~size_t{});
142-
EXPECT_EQ(info.hashes_bitwise_xor.load(), 0);
143140
EXPECT_EQ(info.max_reserve.load(), 0);
144141
EXPECT_EQ(info.weight, 2 * test_stride);
145142
EXPECT_EQ(info.inline_element_size, test_element_size);
@@ -186,17 +183,14 @@ TEST(HashtablezInfoTest, RecordInsertMiss) {
186183
EXPECT_EQ(info.max_probe_length.load(), 6);
187184
EXPECT_EQ(info.hashes_bitwise_and.load(), 0x0000FF00);
188185
EXPECT_EQ(info.hashes_bitwise_or.load(), 0x0000FF00);
189-
EXPECT_EQ(info.hashes_bitwise_xor.load(), 0x0000FF00);
190186
RecordInsertMissSlow(&info, 0x000FF000, 4 * kProbeLength);
191187
EXPECT_EQ(info.max_probe_length.load(), 6);
192188
EXPECT_EQ(info.hashes_bitwise_and.load(), 0x0000F000);
193189
EXPECT_EQ(info.hashes_bitwise_or.load(), 0x000FFF00);
194-
EXPECT_EQ(info.hashes_bitwise_xor.load(), 0x000F0F00);
195190
RecordInsertMissSlow(&info, 0x00FF0000, 12 * kProbeLength);
196191
EXPECT_EQ(info.max_probe_length.load(), 12);
197192
EXPECT_EQ(info.hashes_bitwise_and.load(), 0x00000000);
198193
EXPECT_EQ(info.hashes_bitwise_or.load(), 0x00FFFF00);
199-
EXPECT_EQ(info.hashes_bitwise_xor.load(), 0x00F00F00);
200194
}
201195

202196
TEST(HashtablezInfoTest, RecordErase) {

absl/container/internal/raw_hash_set_test.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,8 +2830,6 @@ TYPED_TEST(RawHashSamplerTest, Sample) {
28302830
end_size += sampler.Iterate([&](const HashtablezInfo& info) {
28312831
++end_size;
28322832
if (preexisting_info.contains(&info)) return;
2833-
observed_checksums[info.hashes_bitwise_xor.load(
2834-
std::memory_order_relaxed)]++;
28352833
reservations[info.max_reserve.load(std::memory_order_relaxed)]++;
28362834
hit_misses[std::make_pair(
28372835
info.num_insert_hits.load(std::memory_order_relaxed),
@@ -2851,10 +2849,6 @@ TYPED_TEST(RawHashSamplerTest, Sample) {
28512849
// Expect that we sampled at the requested sampling rate of ~1%.
28522850
EXPECT_NEAR((end_size - start_size) / static_cast<double>(tables.size()),
28532851
0.01, 0.005);
2854-
ASSERT_EQ(observed_checksums.size(), 5);
2855-
for (const auto& [_, count] : observed_checksums) {
2856-
EXPECT_NEAR((100 * count) / static_cast<double>(tables.size()), 0.2, 0.05);
2857-
}
28582852

28592853
ASSERT_EQ(reservations.size(), 10);
28602854
for (const auto& [reservation, count] : reservations) {

absl/profiling/hashtable.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ StatusOr<std::string> MarshalHashtableProfile(
7070
const auto key_size_id = builder.InternString("key_size");
7171
const auto value_size_id = builder.InternString("value_size");
7272
const auto soo_capacity_id = builder.InternString("soo_capacity");
73-
const auto checksum_id = builder.InternString("checksum");
7473
const auto table_age_id = builder.InternString("table_age");
7574
const auto max_reserve_id = builder.InternString("max_reserve");
7675

@@ -106,8 +105,6 @@ StatusOr<std::string> MarshalHashtableProfile(
106105
add_label(key_size_id, info.key_size);
107106
add_label(value_size_id, info.value_size);
108107
add_label(soo_capacity_id, info.soo_capacity);
109-
add_label(checksum_id,
110-
info.hashes_bitwise_xor.load(std::memory_order_relaxed));
111108
add_label(
112109
table_age_id,
113110
static_cast<uint64_t>(ToInt64Microseconds(now - info.create_time)));

0 commit comments

Comments
 (0)