-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Extra allocation when modifying arrays #14939
Comments
Please post questions like this that aren't clear-cut bugs on julia-users. |
|
To answer your question |
Obviously there are situations like |
See also #3424 |
@StefanKarpinski Sorry! Will remember for next time. Why these operations were doing this made sense to me, I just see opportunity to improve on it. :) Thanks for your replies! |
No worries! Glad it makes sense. There's definitely ample room for improvement. |
Closing as a duplicater of #249, JuliaLang/LinearAlgebra.jl#119, etc. |
I notice this that doing simply operations on an array can allocate a lot of memory when I don't think it would need to. For example:
From the example above,
foo,(a, 20)
,a[:] += 20
, anda += 20
are all doing the same thing, but my foo function is much faster and takes a fraction of the allocated memory.Should julia's memory management be able to identify those cases and avoid the extra allocation?
The text was updated successfully, but these errors were encountered: