Enum versus abstract typing

every element of a should represent a condition of the system, which can be represented either as a number, as an enum or as a type. At the bottom, there is the updated example using enum.

The use of enum seems quite similar to the C-equivalent version. I assume that behind enum there is a Int type or something like that.
With julia, I would like to keep the speed of that implementation with eventually a better generalization capability as I have seen done by using abstraction. However, I see that performances drop.

in my formulation 30 ms are little, but I plan to significantly scale in dimensions and doubling the computational requirements could mean delay a lot.

@enum xxx x y

function prova7()
    a = Vector{xxx}(undef, 10000000)
    for i = 1:10000000
        a[i] = (mod(i, 2) == 1) ? x : y
    end
end