Hi ! I was wondering if someone could explain me the huge gap I noticed in time and memory cost between these two functions.

```
function fwddiff1(γ::Array{T, 2}) where T<:Real
res = zero(γ)
for i=1:size(γ)[1]-1
res[i, :] = γ[i+1, :] .- γ[i, :]
end
res[end, :] = γ[1, :] .- γ[end, :]
res
end
function fwddiff2(γ::Vector{Complex{T}}) where T<:Real
[[γ[i+1] - γ[i] for i=1:length(γ)-1]; γ[1] - γ[end]]
end
```

It seems the second one is an order of magnitude faster than the first one, and the same situation holds about memory footprint. I thought vectorizing things was not a good idea in Julia, which is why I’m confused about this ! What puzzles me even more is that in the simpler following example, there is almost no difference between the two functions …

```
function f1(x::Vector{T}) where T<:Real
res = zero(x)
for i=2:length(x)
res[i] = x[i-1] + x[i]
end
res
end
function f2(x::Vector{T}) where T<:Real
[x[i-1] + x[i] for i=2:length(x)]
end
```

Thanks in advance !