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

Function BenchmarkAndImpl

cpp/src/arrow/util/bit_util_benchmark.cc:136–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134
135template <typename DoAnd>
136static void BenchmarkAndImpl(benchmark::State& state, DoAnd&& do_and) {
137 int64_t nbytes = state.range(0);
138 int64_t offset = state.range(1);
139
140 std::shared_ptr<Buffer> buffer_1 = CreateRandomBuffer(nbytes);
141 std::shared_ptr<Buffer> buffer_2 = CreateRandomBuffer(nbytes);
142 std::shared_ptr<Buffer> buffer_3 = CreateRandomBuffer(nbytes);
143
144 const int64_t num_bits = nbytes * 8 - offset;
145
146 internal::Bitmap bitmap_1{buffer_1, 0, num_bits};
147 internal::Bitmap bitmap_2{buffer_2, offset, num_bits};
148 internal::Bitmap bitmap_3{buffer_3, 0, num_bits};
149
150 for (auto _ : state) {
151 do_and({bitmap_1, bitmap_2}, &bitmap_3);
152 benchmark::ClobberMemory();
153 }
154 state.SetBytesProcessed(state.iterations() * nbytes);
155}
156
157static void BenchmarkBitmapAnd(benchmark::State& state) {
158 BenchmarkAndImpl(state, [](const internal::Bitmap(&bitmaps)[2], internal::Bitmap* out) {

Callers 4

BenchmarkBitmapAndFunction · 0.85

Calls 1

CreateRandomBufferFunction · 0.70

Tested by

no test coverage detected