Skip to content

Commit

Permalink
PARQUET-597: Add data rates to benchmark output
Browse files Browse the repository at this point in the history
Author: Uwe L. Korn <uwelk@xhochy.com>

Closes apache#94 from xhochy/parquet-597 and squashes the following commits:

6442eb7 [Uwe L. Korn] PARQUET-597: Add data rates to benchmark output
  • Loading branch information
xhochy authored and wesm committed Sep 2, 2018
1 parent 8334317 commit 3af2c6b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cpp/src/parquet/column/column-io-benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ std::shared_ptr<ColumnDescriptor> Int64Schema(Repetition::type repetition) {
node, repetition != Repetition::REQUIRED, repetition == Repetition::REPEATED);
}

void SetBytesProcessed(::benchmark::State& state, Repetition::type repetition) {
int64_t bytes_processed = state.iterations() * state.range_x() * sizeof(int64_t);
if (repetition != Repetition::REQUIRED) {
bytes_processed += state.iterations() * state.range_x() * sizeof(int16_t);
}
if (repetition == Repetition::REPEATED) {
bytes_processed += state.iterations() * state.range_x() * sizeof(int16_t);
}
state.SetBytesProcessed(state.iterations() * state.range_x() * sizeof(int16_t));
}

template <Repetition::type repetition>
static void BM_WriteInt64Column(::benchmark::State& state) {
format::ColumnChunk metadata;
Expand All @@ -60,6 +71,7 @@ static void BM_WriteInt64Column(::benchmark::State& state) {
values.size(), definition_levels.data(), repetition_levels.data(), values.data());
writer->Close();
}
SetBytesProcessed(state, repetition);
}

BENCHMARK_TEMPLATE(BM_WriteInt64Column, Repetition::REQUIRED)->Range(1024, 65536);
Expand Down Expand Up @@ -103,6 +115,7 @@ static void BM_ReadInt64Column(::benchmark::State& state) {
repetition_levels_out.data(), values_out.data(), &values_read);
}
}
SetBytesProcessed(state, repetition);
}

BENCHMARK_TEMPLATE(BM_ReadInt64Column, Repetition::REQUIRED)
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/parquet/encodings/encoding-benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ static void BM_PlainEncodingBoolean(::benchmark::State& state) {
InMemoryOutputStream dst;
encoder.Encode(values, values.size(), &dst);
}
state.SetBytesProcessed(state.iterations() * state.range_x() * sizeof(bool));
}

BENCHMARK(BM_PlainEncodingBoolean)->Range(1024, 65536);
Expand All @@ -49,6 +50,7 @@ static void BM_PlainDecodingBoolean(::benchmark::State& state) {
decoder.Decode(output, values.size());
}

state.SetBytesProcessed(state.iterations() * state.range_x() * sizeof(bool));
delete[] output;
}

Expand All @@ -62,6 +64,7 @@ static void BM_PlainEncodingInt64(::benchmark::State& state) {
InMemoryOutputStream dst;
encoder.Encode(values.data(), values.size(), &dst);
}
state.SetBytesProcessed(state.iterations() * state.range_x() * sizeof(int64_t));
}

BENCHMARK(BM_PlainEncodingInt64)->Range(1024, 65536);
Expand All @@ -78,6 +81,7 @@ static void BM_PlainDecodingInt64(::benchmark::State& state) {
decoder.SetData(values.size(), buf->data(), buf->size());
decoder.Decode(values.data(), values.size());
}
state.SetBytesProcessed(state.iterations() * state.range_x() * sizeof(int64_t));
}

BENCHMARK(BM_PlainDecodingInt64)->Range(1024, 65536);
Expand Down

0 comments on commit 3af2c6b

Please sign in to comment.