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

Function BM_RleEncoding

cpp/src/parquet/column_io_benchmark.cc:289–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287#endif
288
289static void BM_RleEncoding(::benchmark::State& state) {
290 std::vector<int16_t> levels(state.range(0), 0);
291 int64_t n = 0;
292 std::generate(levels.begin(), levels.end(),
293 [&state, &n] { return (n++ % state.range(1)) == 0; });
294 int16_t max_level = 1;
295 int64_t rle_size = LevelEncoder::MaxBufferSize(Encoding::RLE, max_level,
296 static_cast<int>(levels.size()));
297 auto buffer_rle = AllocateBuffer();
298 PARQUET_THROW_NOT_OK(buffer_rle->Resize(rle_size));
299
300 while (state.KeepRunning()) {
301 LevelEncoder level_encoder;
302 level_encoder.Init(Encoding::RLE, max_level, static_cast<int>(levels.size()),
303 buffer_rle->mutable_data(), static_cast<int>(buffer_rle->size()));
304 level_encoder.Encode(static_cast<int>(levels.size()), levels.data());
305 }
306 state.SetBytesProcessed(state.iterations() * state.range(0) * sizeof(int16_t));
307 state.SetItemsProcessed(state.iterations() * state.range(0));
308}
309
310BENCHMARK(BM_RleEncoding)->RangePair(1024, 65536, 1, 16);
311

Callers

nothing calls this directly

Calls 9

AllocateBufferFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
ResizeMethod · 0.45
InitMethod · 0.45
mutable_dataMethod · 0.45
EncodeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected