Naming elements in a Matrix

NamedTuples are fine when one needs to return multiple values from a function and doesn’t want to create a struct only for this purpose. It’s an on the fly struct.

Dicts are slow to lookup, whereas lookup in a named tuple is typically compiled away. With heterogeneous types, using a Dict will typically lead to dynamic dispatch, which is devastating for performance.

8 Likes