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

Function BenchmarkCSVParsing

cpp/src/arrow/csv/parser_benchmark.cc:158–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158static void BenchmarkCSVParsing(benchmark::State& state, // NOLINT non-const reference
159 const std::string& csv, int32_t num_rows,
160 ParseOptions options) {
161 BlockParser parser(options, -1, num_rows + 1);
162
163 while (state.KeepRunning()) {
164 uint32_t parsed_size = 0;
165 ABORT_NOT_OK(parser.Parse(std::string_view(csv), &parsed_size));
166
167 // Include performance of visiting the parsed values, as that might
168 // vary depending on the parser's internal data structures.
169 bool dummy_quoted = false;
170 uint32_t dummy_size = 0;
171 auto visit = [&](const uint8_t* data, uint32_t size, bool quoted) {
172 dummy_size += size;
173 dummy_quoted ^= quoted;
174 return Status::OK();
175 };
176 for (int32_t col = 0; col < parser.num_cols(); ++col) {
177 ABORT_NOT_OK(parser.VisitColumn(col, visit));
178 benchmark::DoNotOptimize(dummy_size);
179 benchmark::DoNotOptimize(dummy_quoted);
180 }
181 }
182
183 state.SetBytesProcessed(state.iterations() * csv.size());
184}
185
186static void BenchmarkCSVParsing(benchmark::State& state, // NOLINT non-const reference
187 const Example& example, ParseOptions options) {

Callers 5

ParseCSVQuotedBlockFunction · 0.85
ParseCSVEscapedBlockFunction · 0.85
ParseCSVFlightsExampleFunction · 0.85
ParseCSVVehiclesExampleFunction · 0.85
ParseCSVStocksExampleFunction · 0.85

Calls 5

BuildCSVDataFunction · 0.85
num_colsMethod · 0.80
OKFunction · 0.50
ParseMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected