MCPcopy Create free account
hub / github.com/apache/arrow / BenchmarkStringHashing

Function BenchmarkStringHashing

cpp/src/arrow/util/hashing_benchmark.cc:80–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80static void BenchmarkStringHashing(benchmark::State& state, // NOLINT non-const reference
81 const std::vector<std::string>& values) {
82 uint64_t total_size = 0;
83 for (const std::string& v : values) {
84 total_size += v.size();
85 }
86
87 while (state.KeepRunning()) {
88 hash_t total = 0;
89 for (const std::string& v : values) {
90 total += ComputeStringHash<0>(v.data(), static_cast<int64_t>(v.size()));
91 total += ComputeStringHash<1>(v.data(), static_cast<int64_t>(v.size()));
92 }
93 benchmark::DoNotOptimize(total);
94 }
95 state.SetBytesProcessed(2 * state.iterations() * total_size);
96 state.SetItemsProcessed(2 * state.iterations() * values.size());
97}
98
99static void HashSmallStrings(benchmark::State& state) { // NOLINT non-const reference
100 const std::vector<std::string> values = MakeStrings(10000, 2, 20);

Callers 3

HashSmallStringsFunction · 0.85
HashMediumStringsFunction · 0.85
HashLargeStringsFunction · 0.85

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected