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

Function IntegerParsing

cpp/src/arrow/util/value_parsing_benchmark.cc:128–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126
127template <typename ARROW_TYPE, typename C_TYPE = typename ARROW_TYPE::c_type>
128static void IntegerParsing(benchmark::State& state) { // NOLINT non-const reference
129 auto strings = MakeIntStrings<C_TYPE>(1000);
130
131 while (state.KeepRunning()) {
132 C_TYPE total = 0;
133 for (const auto& s : strings) {
134 C_TYPE value;
135 if (!ParseValue<ARROW_TYPE>(s.data(), s.length(), &value)) {
136 std::cerr << "Conversion failed for '" << s << "'";
137 std::abort();
138 }
139 total = static_cast<C_TYPE>(total + value);
140 }
141 benchmark::DoNotOptimize(total);
142 }
143 state.SetItemsProcessed(state.iterations() * strings.size());
144}
145
146template <typename ARROW_TYPE, typename C_TYPE = typename ARROW_TYPE::c_type>
147static void HexParsing(benchmark::State& state) { // NOLINT non-const reference

Callers

nothing calls this directly

Calls 3

dataMethod · 0.45
lengthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected