julia> cl
485-element Array{Float64,1}:
 4555.0
 4601.0
 4693.0
 4678.0
    ⋮
 5821.0
 5854.0
 5828.0

julia> lagcl = [0, cl[1:end-1]]
485-element Array{Float64,1}:
    0.0
 4555.0
 4601.0
 4693.0
    ⋮
 5842.0
 5821.0
 5854.0

Then thinking to make the types of elements to be the same, I changed the above to the following (notice it is 0.0 instead of 0 at the first element). lagcl is only a temp array in a function that is called only at initialization time and lagcl[1] is actually not referenced at all. But the speed of my app after the initialization dropped to half. Nothing else was changed, and I verified it by changing 0.0 back to 0 at the first element. Could anyone explain?

julia> lagcl = [0.0, cl[1:end-1]]
485-element Array{Float64,1}:
    0.0
 4555.0
 4601.0
 4693.0
    ⋮
 5842.0
 5821.0
 5854.0

Reply via email to