diff --git a/cpp/src/arrow/util/bit_util_benchmark.cc b/cpp/src/arrow/util/bit_util_benchmark.cc index 8e95d014628a3..3bcb4ceea6303 100644 --- a/cpp/src/arrow/util/bit_util_benchmark.cc +++ b/cpp/src/arrow/util/bit_util_benchmark.cc @@ -150,9 +150,7 @@ static void BenchmarkAndImpl(benchmark::State& state, DoAnd&& do_and) { for (auto _ : state) { do_and({bitmap_1, bitmap_2}, &bitmap_3); - auto total = - internal::CountSetBits(bitmap_3.data(), bitmap_3.offset(), bitmap_3.length()); - benchmark::DoNotOptimize(total); + benchmark::ClobberMemory(); } state.SetBytesProcessed(state.iterations() * nbytes); }