Skip to content
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

Optimize performance of math::cot (~2x faster) #12910

Merged
merged 2 commits into from
Oct 16, 2024
Merged

Conversation

tlm365
Copy link
Contributor

@tlm365 tlm365 commented Oct 13, 2024

Rationale for this change

Using the unary functions allows faster processing by avoiding branching on nulls.

What changes are included in this PR?

  • Apply unary
  • Add benchmark

Are these changes tested?

Existing testcases.

Are there any user-facing changes?

No.

**BENCHMARK RESULT
screenshot_2024-10-13_21-01-32

@tlm365 tlm365 marked this pull request as ready for review October 13, 2024 18:06
Copy link
Member

@jonahgao jonahgao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @tlm365

@alamb
Copy link
Contributor

alamb commented Oct 15, 2024

Wow -- we are just cranking right along here. ❤️

@@ -85,18 +85,16 @@ impl ScalarUDFImpl for CotFunc {
///cot SQL function
fn cot(args: &[ArrayRef]) -> Result<ArrayRef> {
match args[0].data_type() {
Float64 => Ok(Arc::new(make_function_scalar_inputs!(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relates to #12923

@alamb alamb merged commit 90720c0 into apache:main Oct 16, 2024
26 checks passed
@tlm365 tlm365 deleted the optimize-cot branch November 10, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants