Open
Description
Having looked at the source code it is clear that when taking a view of an AxisArray, the indexed axes might be copied if _new_axes
is called (https://github.com/JuliaArrays/AxisArrays.jl/blob/master/src/indexing.jl#L80). Is this the intended behaviour? It would make more sense to me for views to be taken of the original axes as well, to aid performance.
Example below (there is 16KB of allocation - i.e. the index copy)
using Dates
using AxisArrays
using BenchmarkTools
index = collect(DateTime(2018, 1, 1):Minute(1):DateTime(2018, 1, 10))
B = AxisArray(randn(Float64, (length(index), 10)), index)
@btime view(B, 1000:3000, :)
# 994.800 ns (6 allocations: 15.98 KiB)
If this should be fixed / changed, I'm happy to give a PR a go.
Metadata
Metadata
Assignees
Labels
No labels