That’s correct, see the links in Avoiding Vectors of Abstract Types - #20 by tim.holy or Elimination of (unnecessary) runtime dispatch allocations - #2 by mbauman for more on this.
Solution-wise, I’m going to assume there are a finite number of possible TestN
types. In that case, using a sum types package like SumTypes.jl, DynamicSumTypes.jl, Moshi.jl, etc. would remove allocations related to type instability.