Is UnionAll abstract? Is it bad for performance?

Yes, UnionAll is abstract.

if your container struct and dict only hold one particular subtype of that UnionAll you can do

mutable struct container_struct{T<:MyType}
    a::T
    b::Dict{Int64, T}
end

Otherwise, you can just leave it as you have it if you need a hetrogenious container.
It’s not the end of the world.
We don’t have to scrape every last bit of peformance out.

You can put in function barriers where you need them

5 Likes