From 3ad4b2df87e407921d2706bfad1e3ff7b35fc67c Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Thu, 19 Mar 2015 17:22:15 -0500 Subject: [PATCH] Fix a ReshapedArray indexing performance regression --- base/reshapedarray.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/base/reshapedarray.jl b/base/reshapedarray.jl index 3b253828a977c..2a0288d8aa24d 100644 --- a/base/reshapedarray.jl +++ b/base/reshapedarray.jl @@ -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