findepi opened a new pull request, #12477: URL: https://github.com/apache/datafusion/pull/12477
`make_scalar_function` serves as a template to implement functions, abstracting away processing of scalar values. While it's recommended to implement `ScalarUDFImpl` directly, a few functions still use the `make_scalar_function` helper, perhaps because it reduces code verbosity. While `make_scalar_function` is a template function, it's not eligible for effective inlining because of the `Arc<Fn>` return type. This commit removes `Arc` and unlocks inlining. The change impact was verified manually using `cargo rustc -p datafusion-functions-nested -- --emit asm -C opt-level=2` and comparing the generated for `ArrayDistance::invoke` exemplary function that uses `make_scalar_function`. Only after the changes can `ArrayDistance::invoke` call the `array_distance_inner` directly. The change saves some small overhead on each invocation of a UDF, but doesn't improve per-row performance. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
