Performance disadvantages of structs?

Well, usually you do not need mutable structures. Arrays are mutable on their own, so usually you do not need to keep them in mutable structure. You can find multiple ways to work with immutable fields in Mutable scalar in immutable object: the best alternative? and references therein, for example wrap them in Ref. And there is always Setfield.jl, which has its problems, but still can be used to solve many tasks.

As a reward, you’ll be able to change flexibly these data containers and use as many of them as necessary.

1 Like