Why are calls to this function slow, compared to Python+Numpy?

This computesthe same thing as the original post about 10x faster on my machine, without “cheating” using threads:

function test(s,a)
         g = Vector{Float64}(s)
         ap1= a+1
         ap1inv = inv(ap1)
         @inbounds for i =1:s
           k = i+1.0
           @fastmath g[i] = (k^ap1-(k-1)^ap1)*ap1inv
         end
end
3 Likes