Skip to content

Commit

Permalink
Exercise different numbers of columns
Browse files Browse the repository at this point in the history
  • Loading branch information
AlenkaF committed Mar 22, 2024
1 parent c364331 commit 2e1e958
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cpp/src/arrow/tensor_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ static void BatchToTensorSimple(benchmark::State& state) {
std::vector<std::shared_ptr<Field>> fields = {};
std::vector<std::shared_ptr<Array>> columns = {};

for (int i = 0; i < 100; ++i) {
const int NumCols = state.range(1);
for (int i = 0; i < NumCols; ++i) {
fields.push_back(field("f" + std::to_string(i), ty));
columns.push_back(gen_.ArrayOf(ty, kNumRows));
}
Expand All @@ -46,14 +47,15 @@ static void BatchToTensorSimple(benchmark::State& state) {
for (auto _ : state) {
ASSERT_OK_AND_ASSIGN(auto tensor, batch->ToTensor());
}
state.SetItemsProcessed(state.iterations() * kNumRows * batch->num_columns());
state.SetBytesProcessed(state.iterations() * ty->byte_width() * kNumRows *
batch->num_columns());
state.SetItemsProcessed(state.iterations() * kNumRows * NumCols);
state.SetBytesProcessed(state.iterations() * ty->byte_width() * kNumRows * NumCols);
}

void SetArgs(benchmark::internal::Benchmark* bench) {
for (int64_t size : {kL1Size, kL2Size}) {
bench->Arg(size);
for (int number_of_columns : {3, 30, 300}) {
bench->Args({size, number_of_columns});
}
}
}

Expand Down

0 comments on commit 2e1e958

Please sign in to comment.