The difference is probably simd. the branch will code will not use simd.
Either of these should eliminate branch and allow simd.
ak += ss1>ss2
ak += ifelse(ss1>ss2, 1, 0)
Check with @code_llvm, look for section vector.body
at 5:45:30 AM UTC+10, Dupont wrote:
> What is strange to me is that this is much slower
>
>
> function essai(n, s1, s2)
> a = Vector{Int64}(n)
>
> @inbounds for k = 1:n
> ak = 0
> for ss1 in s1, ss2 in s2
> if ss1 > ss2
> ak += 1
> end
> end
> a[k] = ak
> end
> end
>
>
>
