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

Simplify (and slightly speed up) coefb/coefa #607

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

martinholters
Copy link
Member

@martinholters martinholters commented Dec 6, 2024

Noticed this the other day. Main benefit is readability. Only in cases where trailing/leading zeros had to be re-appended/prepended, one allocation is eliminated. Otherwise, performance is almost unchanged.

Copy link

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.96%. Comparing base (16f1ec0) to head (6e55a5e).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #607   +/-   ##
=======================================
  Coverage   97.96%   97.96%           
=======================================
  Files          19       19           
  Lines        3248     3248           
=======================================
  Hits         3182     3182           
  Misses         66       66           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@wheeheee wheeheee left a comment

Choose a reason for hiding this comment

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

Somewhat forgot how the indexing into LaurentPolynomial works, but are there a lot of branches to getindex the leading/trailing zeros? Maybe that's bad for branch prediction or something. Anyhow, saving one allocation is probably better.

@martinholters
Copy link
Member Author

Well, yes, the getindex branches on whether the requested index is inside the stored coefficients, but Polynomials.coeffs also calls getindex internally, so not much difference there.

@martinholters martinholters merged commit 51c17d6 into master Dec 9, 2024
11 checks passed
@martinholters martinholters deleted the mh/simplify-polynomialratio-coef branch December 9, 2024 07:04
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