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

operate_fallback!! shouldn't force the first argument to be copied #287

Open
blegat opened this issue May 16, 2024 · 0 comments
Open

operate_fallback!! shouldn't force the first argument to be copied #287

blegat opened this issue May 16, 2024 · 0 comments

Comments

@blegat
Copy link
Member

blegat commented May 16, 2024

In this redirection:

function operate_to_fallback!!(
::IsNotMutable,
output,
op::F,
args::Vararg{Any,N},
) where {F<:Function,N}
return operate(op, args...)
end

We redirect to operate because for instance, when it's used in the @rewrite macro, we want to modify the result so it cannot depend on the the arguments.
However, since the first argument was given to operate!!, it can actually be modified! So in this case, we want a result that does not depend on any argument except the first one.
This can causes performance issues in https://github.com/JuliaAlgebra/StarAlgebras.jl/pull/21/files#diff-3f191d1ba6c7bc538c1bf193064434a4984a0457baac3da62c9e6dede5d566aa for canonical as reported by @kalmarek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant