JuliaArrays / AxisArrays.jl

Performant arrays where each dimension can have a named axis with values
http://JuliaArrays.github.io/AxisArrays.jl/latest/
Other
200 stars 41 forks source link

Significant regression when indexing by value in 0.7 #136

Closed niclasmattsson closed 6 years ago

niclasmattsson commented 6 years ago

Apologies if this is a known issue and/or if the transition to 0.7 is still incomplete, but just in case I thought I should report this.

julia> a = AxisArray(rand(3,3), [:a,:b,:c], [:x,:y,:z])
2-dimensional AxisArray{Float64,2,...} with axes:
    :row, Symbol[:a, :b, :c]
    :col, Symbol[:x, :y, :z]
And data, a 3×3 Array{Float64,2}:
 0.991885  0.000544059  0.511753
 0.242214  0.0773739    0.131205
 0.42773   0.532756     0.565765

julia> test(a) = a[:a,:x]
test (generic function with 1 method)

Version 0.6.2:

julia> @btime test(a);
  53.651 ns (1 allocation: 16 bytes)

Version 0.7.0-DEV.4958:

julia> @btime test(a);
  571.501 μs (223 allocations: 25.45 KiB)
iamed2 commented 6 years ago

I think this may just be down to using deprecated methods. I'm looking into it.

iamed2 commented 6 years ago

Yep, that was it!

niclasmattsson commented 6 years ago

Great, glad it was so easy. Thanks for looking into it so quickly!