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

Function BM_DeltaDecodingByteArray

cpp/src/parquet/encoding_benchmark.cc:976–999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

974}
975
976static void BM_DeltaDecodingByteArray(benchmark::State& state) {
977 DeltaByteArrayState delta_state(state);
978 std::vector<ByteArray> values = delta_state.MakeRandomByteArray(/*seed=*/42);
979
980 auto encoder = MakeTypedEncoder<ByteArrayType>(Encoding::DELTA_BYTE_ARRAY);
981 encoder->Put(values.data(), static_cast<int>(values.size()));
982 std::shared_ptr<Buffer> buf = encoder->FlushValues();
983
984 const int64_t plain_encoded_size =
985 delta_state.total_data_size + 4 * delta_state.array_length;
986 const int64_t encoded_size = buf->size();
987
988 auto decoder = MakeTypedDecoder<ByteArrayType>(Encoding::DELTA_BYTE_ARRAY);
989 for (auto _ : state) {
990 decoder->SetData(delta_state.array_length, buf->data(),
991 static_cast<int>(buf->size()));
992 decoder->Decode(values.data(), static_cast<int>(values.size()));
993 ::benchmark::DoNotOptimize(values);
994 }
995 state.SetItemsProcessed(state.iterations() * delta_state.array_length);
996 state.SetBytesProcessed(state.iterations() * delta_state.total_data_size);
997 state.counters["compression_ratio"] =
998 static_cast<double>(plain_encoded_size) / encoded_size;
999}
1000
1001static void ByteArrayDeltaCustomArguments(benchmark::internal::Benchmark* b) {
1002 for (int max_string_length : {8, 64, 1024}) {

Callers

nothing calls this directly

Calls 7

MakeRandomByteArrayMethod · 0.80
PutMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
FlushValuesMethod · 0.45
SetDataMethod · 0.45
DecodeMethod · 0.45

Tested by

no test coverage detected