Skip to content

Optimize Async poly interpolation hot path via Horner-form polynomial evaluation - #138

Merged
HEnquist merged 1 commit into
masterfrom
copilot/check-issue-135
Aug 5, 2026
Merged

Optimize Async poly interpolation hot path via Horner-form polynomial evaluation#138
HEnquist merged 1 commit into
masterfrom
copilot/check-issue-135

Conversation

Copilot AI commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Issue #135 identified many optimization ideas in Async::new_poly; the high-value, low-risk part was reducing arithmetic cost in polynomial evaluation. This PR implements only that part by replacing explicit power expansion with Horner-form evaluation in the poly interpolation kernels.

  • What changed

    • src/asynchro_fast.rs: polynomial kernel rewrite
      • Updated interp_septic, interp_quintic, and interp_cubic to evaluate the same polynomials using Horner form.
      • Removed intermediate power terms (x2, x3, ...), reducing multiply count and tightening the inner interpolation path.
  • Scope intentionally kept narrow

    • No structural refactors
      • Did not introduce scratch-buffer reuse, loop reordering, or API/behavior changes from the broader issue discussion.
      • Kept this PR focused on arithmetic optimization in the existing implementation shape.
  • Example (pattern used)

// before
let x2 = x * x;
let x3 = x2 * x;
a0 + a1 * x + a2 * x2 + a3 * x3

// after
a0 + x * (a1 + x * (a2 + x * a3))

@HEnquist
HEnquist marked this pull request as ready for review July 23, 2026 22:49
@HEnquist
HEnquist merged commit 224fb0d into master Aug 5, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants