# Slow abstractarray.jl, indices: line 64 when starting julia with `--inline=no`

When I use ProfileView to profile my code it shows that most of the time is consumed in:

``````abstractarray.jl, indices: line 64
``````

Every arrow is pointing to time consumed in `abstractarray.jl, indices: line 64`

Unfortunately, it often shows up at the very top of the stack trace after multiple julia calls, which makes it hard to debug.

Is there a way to circumvent this performance bottleneck?

BTW: This is julia 0.6.3

Without code itâ€™s impossible to know whatâ€™s going on. But

it looks like youâ€™re calling `indices` a lot, which is causing allocations, which wouldnâ€™t be a good idea.

The easiest example I could come up with is this:

``````function norm_matrix(lut::Array{Complex{Float64}, 3})
powers = sum(abs2.(lut), 1)
max_gain = maximum(powers)
lut ./ sqrt(max_gain)
end
using ProfileView
const A = complex.(randn(4,360,90), randn(4,360,90))
norm_matrix(A);
@profile norm_matrix(A);
ProfileView.view()
``````
2 Likes

Thatâ€™s a wonderful example â€” thank you! Iâ€™ll dig into this.

1 Like

Hm, with that example I donâ€™t see `indices` appear at all in the profile. I did modify it slight to get it to work:

``````function norm_matrix(lut::Array{Complex{Float64}, 3})
powers = sum(abs2.(lut), 1)
max_gain = maximum(powers)
lut ./ sqrt(max_gain)
end
const A = complex.(randn(4,360,90), randn(4,360,90))
norm_matrix(A);
@profile for _ in 1:10000; norm_matrix(A); end
``````

Perhaps youâ€™re calling a different `norm_matrix`?

Sorry, I forgot to mention that this is only visible when starting julia with `--inline=no`
I started julia with inline=no to see where the actual bottlenecks are, but I guess this makes it even worse?

Oooh, yeah, thatâ€™s not going to do what you want.

Juliaâ€™s performance is heavily dependent upon inlining. Sure, you might get more â€śaccurateâ€ť stack traces, but the runtime performance will be so abysmally different that the report will be completely useless for identifying bottlenecks.

3 Likes