using Transducers
using BenchmarkTools
x = randn(10240);
y = randn(10240);
function f2(x, y)
total = 0
@inbounds for i in 1:length(x)
total += x[i] == y[i]
end
return total
end
f3(x, y) = foldxl(+, MapSplat(==), zip(x, y); simd = true)
f4(x, y) = foldxl(+, MapSplat(==), zip(x, y); init = 0, simd = true)
@btime f2(x, y)
@btime f3(x, y)
@btime f4(x, y)
prints