BenchmarkTools setup isn't run between each iteration?

evals is just another keyword argument, like setup:

julia> @btime sort!(x) setup=(x = rand(5)) evals=1
  38.000 ns (0 allocations: 0 bytes)
5-element Array{Float64,1}:
 0.27202634588420826
 0.3043204769033667 
 0.38124617952216444
 0.44094427015230697
 0.4785747961346507 

or, with more parentheses for clarity:

julia> @btime(sort!(x), setup=(x = rand(5)), evals=1)
  43.000 ns (0 allocations: 0 bytes)
5-element Array{Float64,1}:
 0.2818970773419529
 0.6447645561336768
 0.7669354473160204
 0.789996892969342 
 0.8448189472593695
2 Likes