Vectors of Unions between concrete type and singleton type

According to the docs, Vector{Union{Missing, <:Any}} can be fast fast because they use a special memory layout to mark “missing” fields.
Is that special handling for missing, or is it true for Arrays of all singleton unions, such as Union{Nothing, <:Any} or Union{Makie.Automatic, <:Any}?

Any ruins everything, nothing is gonna be fast if you have abstract type in array

But otherwise, it’s true for all singletom

By writing Union{Missing, <:Any} I meant that the second type in the Union is a concrete subtype and bitstype, similar to the Missing case.

But otherwise, it’s true for all singletom

okay, thanks!

1 Like