-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow specialized implementations to produce hints for the array adapter #3765
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me -- thank you @isidentical
I wonder if you have any benchmark results that show this pattern improving performance?
/// - (default) `false`: indicates the argument needs to be padded if it is scalar | ||
/// - `true`: indicates the argument can be converted to an array of length 1 | ||
/// | ||
pub(crate) fn make_scalar_function_with_hints<F>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that this is pub(crate)
is good given its specialized nature (and potential possibility of change)
Yep, I was playing with the idea of using the existing null buffers for Also a subsequent optimization (using the existing null buffers) was unnoticeable before this change, but now we can clearly see the benefit of it since the actual time is now spent on result array construction inside |
1e858c5
to
aa9667a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @isidentical !
(_, true, true, true) => Ok(make_scalar_function_with_hints( | ||
_regexp_replace_static_pattern_replace::<T>, | ||
vec![ | ||
Hint::Pad, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
Thanks again @isidentical |
Benchmark runs are scheduled for baseline = 8db6af2 and contender = f132259. f132259 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Which issue does this PR close?
Closes #3762.
Rationale for this change
More details on #3762, but simply this allows us to instruct array/scalar function adapter to skip padding some arguments since the specialized version of functions don't need them.
What changes are included in this PR?
A new
make_scalar_function_with_hints
API (not public) that can take a list of hints and then map them to corresponding arguments and use it to decide whether they need padding or not.This PR also provides usage of the new hints API, which in turn can speed-up
regex_replace
up to 1.3x.Are there any user-facing changes?
No, this is a new API / optimization that can provide up to %25 speed-up.