Skip to content

Commit 3ad4b2d

Browse files
committed
Fix a ReshapedArray indexing performance regression
1 parent 4c17ea3 commit 3ad4b2d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

base/reshapedarray.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,19 @@ stagedfunction getindex{T,N,P,I}(A::ReshapedArray{T,N,P,I}, indexes::Real...)
118118
for i = 1:npc[end]
119119
j = findlast(npc .< i)
120120
di = i - npc[j]
121-
push!(argsout, Expr(:..., :(tindex[$j][$di])))
121+
push!(argsout, :(tindex[$j][$di]))
122+
end
123+
else
124+
for i = 1:npc[end]
125+
push!(argsout, :(tindex[$i]))
122126
end
123127
end
124128
meta = Expr(:meta, :inline)
125129
ex = length(argsin) == 1 ?
126130
quote
127131
$meta
128-
getindex(A.parent, $(argsin...)...)
132+
tindex = $(argsin...)
133+
getindex(A.parent, $(argsout...))
129134
end :
130135
quote
131136
$meta

0 commit comments

Comments
 (0)