From 1b82cd337090279f1121be66d1200bda3f80f6e9 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Wed, 8 Jan 2025 10:04:14 +0100 Subject: [PATCH] Fix benchmark --- cpp/src/parquet/arrow/size_stats_benchmark.cc | 18 +++++++++--------- cpp/submodules/parquet-testing | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cpp/src/parquet/arrow/size_stats_benchmark.cc b/cpp/src/parquet/arrow/size_stats_benchmark.cc index 7f19f6f936387..5efcd5c84b7b6 100644 --- a/cpp/src/parquet/arrow/size_stats_benchmark.cc +++ b/cpp/src/parquet/arrow/size_stats_benchmark.cc @@ -95,13 +95,15 @@ void WriteColumn(::benchmark::State& state, const std::shared_ptr<::arrow::Table std::static_pointer_cast<::arrow::io::OutputStream>(output), DEFAULT_MAX_ROW_GROUP_LENGTH, properties)); - state.PauseTiming(); - - auto metadata = parquet::ReadMetaData( - std::make_shared<::arrow::io::BufferReader>(output->Finish().ValueOrDie())); - state.counters["output_size"] = static_cast(output->Tell().ValueOrDie()); - state.counters["page_index_size"] = - static_cast(GetTotalPageIndexSize(metadata)); + if (state.counters.find("page_index_size") == state.counters.end()) { + state.PauseTiming(); + auto metadata = parquet::ReadMetaData( + std::make_shared<::arrow::io::BufferReader>(output->Finish().ValueOrDie())); + state.counters["output_size"] = static_cast(output->Tell().ValueOrDie()); + state.counters["page_index_size"] = + static_cast(GetTotalPageIndexSize(metadata)); + state.ResumeTiming(); + } } state.SetItemsProcessed(state.iterations() * kBenchmarkSize); @@ -158,5 +160,3 @@ BENCHMARK_TEMPLATE(BM_WriteListColumn, SizeStatisticsLevel::PageAndColumnChunk, ::arrow::StringType); } // namespace parquet::benchmark - -BENCHMARK_MAIN(); diff --git a/cpp/submodules/parquet-testing b/cpp/submodules/parquet-testing index a7f1d288e693d..c7cf1374cf284 160000 --- a/cpp/submodules/parquet-testing +++ b/cpp/submodules/parquet-testing @@ -1 +1 @@ -Subproject commit a7f1d288e693dbb08e3199851c4eb2140ff8dff2 +Subproject commit c7cf1374cf284c0c73024cd1437becea75558bf8