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

Function TimedTestOutputStringAllocs

cpp/src/gandiva/tests/micro_benchmarks.cc:256–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254}
255
256static void TimedTestOutputStringAllocs(benchmark::State& state) {
257 // schema for input fields
258 auto field_a = field("abcdefghijklmnopqrstuvwxyz", arrow::utf8());
259 auto schema = arrow::schema({field_a});
260 auto pool_ = arrow::default_memory_pool();
261 // output field
262 auto field_res = field("res", utf8());
263
264 // Build expression
265 auto node_a = TreeExprBuilder::MakeField(field_a);
266 auto upper = TreeExprBuilder::MakeFunction("upper", {node_a}, utf8());
267 auto length = TreeExprBuilder::MakeFunction("octet_length", {upper}, int32());
268 auto expr = TreeExprBuilder::MakeExpression(upper, field_res);
269
270 std::shared_ptr<Projector> projector;
271 ASSERT_OK(Projector::Make(schema, {expr}, TestConfiguration(), &projector));
272
273 FastUtf8DataGenerator data_generator(64);
274 ProjectEvaluator evaluator(projector);
275
276 ASSERT_OK((TimedEvaluate<arrow::StringType, std::string>(
277 schema, evaluator, data_generator, pool_, 1 * MILLION, 16 * THOUSAND, state)));
278}
279// following two tests are for benchmark optimization of
280// in expr. will be used in follow-up PRs to optimize in expr.
281

Callers

nothing calls this directly

Calls 6

default_memory_poolFunction · 0.85
TestConfigurationFunction · 0.85
fieldFunction · 0.50
schemaFunction · 0.50
MakeFunctionFunction · 0.50
MakeFunction · 0.50

Tested by

no test coverage detected