Skip to content

Commit

Permalink
Fix a ReshapedArray indexing performance regression
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Mar 19, 2015
1 parent 4c17ea3 commit 3ad4b2d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions base/reshapedarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,19 @@ stagedfunction getindex{T,N,P,I}(A::ReshapedArray{T,N,P,I}, indexes::Real...)
for i = 1:npc[end]
j = findlast(npc .< i)
di = i - npc[j]
push!(argsout, Expr(:..., :(tindex[$j][$di])))
push!(argsout, :(tindex[$j][$di]))
end
else
for i = 1:npc[end]
push!(argsout, :(tindex[$i]))
end
end
meta = Expr(:meta, :inline)
ex = length(argsin) == 1 ?
quote
$meta
getindex(A.parent, $(argsin...)...)
tindex = $(argsin...)
getindex(A.parent, $(argsout...))
end :
quote
$meta
Expand Down

0 comments on commit 3ad4b2d

Please sign in to comment.