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

copy for BigInt, BigFloat and Rational #238

Merged
merged 1 commit into from
Nov 28, 2023
Merged

copy for BigInt, BigFloat and Rational #238

merged 1 commit into from
Nov 28, 2023

Conversation

nsajko
Copy link
Contributor

@nsajko nsajko commented Nov 26, 2023

Fixes #163.

Copy link

codecov bot commented Nov 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4cc20ad) 89.66% compared to head (aa79211) 89.72%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #238      +/-   ##
==========================================
+ Coverage   89.66%   89.72%   +0.06%     
==========================================
  Files          23       23              
  Lines        2157     2171      +14     
==========================================
+ Hits         1934     1948      +14     
  Misses        223      223              

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

@nsajko
Copy link
Contributor Author

nsajko commented Nov 26, 2023

The failing Aqua lint is unrelated (Aqua is complaining about missing compat bounds for dependencies).

@odow
Copy link
Member

odow commented Nov 26, 2023

The failing Aqua lint is unrelated (Aqua is complaining about missing compat bounds for dependencies).

I can fix this; #239

@odow odow requested a review from blegat November 26, 2023 23:16
Copy link
Member

@odow odow left a comment

Choose a reason for hiding this comment

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

Looks okay to me, but this needs @blegat's review.

)
return nothing
end
set! = (o, i) -> operate_to!(o, copy, i)
Copy link
Member

Choose a reason for hiding this comment

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

I think you need to keep the local to avoid the performance issue of closures

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's fine:

julia> import MutableArithmetics, LinearAlgebra; const MA = MutableArithmetics;

julia> x = BigFloat[1, 3];

julia> y = BigFloat[3, 1];

julia> buf = MA.buffer_for(LinearAlgebra.dot, typeof(x), typeof(y))
MutableArithmetics.DotBuffer{BigFloat}(NaN, NaN, NaN, NaN)

julia> import MutableArithmetics, LinearAlgebra; const MA = MutableArithmetics;

julia> x = BigFloat[1, 3];

julia> y = BigFloat[3, 1];

julia> buf = MA.buffer_for(LinearAlgebra.dot, typeof(x), typeof(y));

julia> using JET

julia> @report_opt MA.buffered_operate_to!(buf, big(1.2), LinearAlgebra.dot, x, y)
No errors detected

julia> @report_call MA.buffered_operate_to!(buf, big(1.2), LinearAlgebra.dot, x, y)
No errors detected

TBH I'm not even completely sure why I used local back when I wrote the code. I think I may have simply considered it good style to use local with any local variable. I don't use local at all any more.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Besides, the tests would have caught any extra allocations.

Copy link
Member

@blegat blegat left a comment

Choose a reason for hiding this comment

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

Thanks!

@blegat blegat merged commit 28125f4 into jump-dev:master Nov 28, 2023
11 checks passed
@nsajko nsajko deleted the copy branch November 28, 2023 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Why is there no mutable assignment operation?
3 participants