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

Function BM_RleEncoding

cpp/src/parquet/column_io_benchmark.cc:290–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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