You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, views-of-views construct their re-indexed indices by slicing
into the parent indices. This PR changes this to use views of the parent
indices instead. This makes the operation faster and non-allocating if
the `parentindices` for the original view are `Vector`s.
```julia
julia> a = rand(200, 200);
julia> av = view(a, collect.(axes(a))...);
julia> @Btime view($av, axes($av)...);
312.393 ns (4 allocations: 3.25 KiB) # master
7.354 ns (0 allocations: 0 bytes) # PR
```
Indexing into the resulting view seems equally fast in simple cases:
```julia
julia> av2 = view(av, axes(av)...);
julia> @Btime sum($av2);
66.883 μs (0 allocations: 0 bytes) # master
66.888 μs (0 allocations: 0 bytes) # PR
julia> av2 = view(av, collect.(axes(av))...);
julia> @Btime sum($av2);
66.886 μs (0 allocations: 0 bytes) # master
66.891 μs (0 allocations: 0 bytes) # PR
```
---------
Co-authored-by: N5N3 <[email protected]>
0 commit comments