Isn’t this the exact same discussion as The cost of size() in for-loops? If the number of iterations is constant, the loop can be unrolled. If you want the compiler to specialize on specific array sizes, use StaticArrays.jl.
4 Likes