Array performance Julia 0.6 vs 0.5

I you want to test only the array comparison speed, then perhaps something like this is a better benchmark:

function speedtest(a, b)
    if VERSION < v"0.6.0"
        (a .< 7) & (b .< 7)
    else
        (a .< 7) .& (b .< 7)
    end
end

a = [1:10;]
b = 2*a + 1

using BenchmarkTools
@btime speedtest($a, $b)

I get the following times:

v0.5.2:  3.910 μs (11 allocations: 8.80 KiB)
v0.6.2:  641.472 ns (4 allocations: 4.33 KiB)
v0.7.0:  402.601 ns (3 allocations: 4.31 KiB)
1 Like