Skip to content

Conversation

@kumarUjjawal
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

The round function currently converts scalar inputs to arrays before processing, even when both value and decimal_places are scalar values. This adds unnecessary overhead for constant folding scenarios like

What changes are included in this PR?

  • Add scalar fast path in RoundFunc::invoke_with_args for Float64 and Float32 inputs
  • Directly compute the result when both inputs are scalars, avoiding array conversion overhead
  • Add benchmark

Are these changes tested?

Yes

Type Before After Speedup
round_f64_scalar 570 ns 195 ns 2.9x
round_f32_scalar 564 ns 192 ns 2.9x

Are there any user-facing changes?

No

@github-actions github-actions bot added the functions Changes to functions implementation label Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant