Enum type as field value performance

The enum is much more performant. Internally, a Julia enum is just an integer with a restricted set of values enforced at instantiation, and some names attached to each value.
You can even make the enum a custom size, i.e. if you know for sure you only need at most 256 variants, you can do @enum Side::UInt8 bid ask, and it’ll be 1 byte in size.

3 Likes