Maybe this is worth sharing. When considering using enums instead of types, I came up with 7 different ways to dispatch to methods, and these are the results of the performance tests.
The code is at: https://gist.github.com/felipenoris/660537161af33db34dcb *Results:* julia> include("enum-vs-dispatch.jl") enums with switch code 323.515 milliseconds Dispatch via Val Type 1.068 seconds (30000 k allocations: 458 MB, 1.96% gc time) Dispatch via Const Val Type 145.355 milliseconds *Dispatch via Type* * 148.047 milliseconds* Vector of functions dispatch 833.969 milliseconds (30000 k allocations: 458 MB, 2.14% gc time) Functors 1.011 seconds (30000 k allocations: 458 MB, 1.62% gc time) Const Functors 147.741 milliseconds