Creating a view (SubArray) of a Vector allocates memory #19257
Closed
Description
On 0.5 as well as the latest nightly, for matrices,
@benchmark view(a, 1:2, 1:2) setup = (a = rand(3, 3))
results in zero allocation.
However,
@benchmark view(a, 1:2) setup = (a = rand(3))
results in 48 bytes of allocation and is almost 6 times slower. I haven't been able to figure out what in subarray.jl
causes this.
Metadata
Assignees
Labels
No labels