I guess this is mostly about the behaviour of map!, but for avoiding 
allocations I think this makes more sense:

function mape4b(A, F)
    tmp = zero(eltype(A))
    N = length(A)
    for i in 1:N
        tmp += abs(_f(A[i], F[i]))
    end
    return 100 * tmp / N
end

For some reason, the time macro doesn't give me any number for allocation 
in mape4b, but it's 20-25% faster than mape4a and almost twice as fast as 
the broadcast! version on my computer.

I tried using @inbounds but that had no effect whatsoever.

Reply via email to